You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to upgrade my rails version without migration to ruby 3. That's why I try to use ransack not higher than 4.0.0.
I have User model with the following associations:
SELECT DISTINCT "users".* FROM "users"
LEFT OUTER JOIN "sessions_user_surveys" ON "sessions_user_surveys"."user_id" = "users"."id"
LEFT OUTER JOIN "sessions_sessions" ON "sessions_sessions"."id" = "sessions_user_surveys"."session_id"
LEFT OUTER JOIN "sessions_user_surveys" "surveys_users" ON "surveys_users"."user_id" = "users"."id"
WHERE ("sessions_sessions"."id" IN (3) AND "surveys_users"."state" IN ('filling'))
Rails 7 SQL:
SELECT DISTINCT "users".* FROM "users"
LEFT OUTER JOIN "sessions_user_surveys" ON "sessions_user_surveys"."user_id" = "users"."id"
LEFT OUTER JOIN "sessions_sessions" ON "sessions_sessions"."id" = "sessions_user_surveys"."session_id"
WHERE ("sessions_sessions"."id" IN (3) AND "surveys_users"."state" IN ('filling'))
Had the same issue and for me was solved upgrading to version 4.2.1
apaokin
changed the title
After I've upgraded my rails app from 5.2 to 7.0, ransack v 4.0.0 fails to form queries containing the same table twice
After I've upgraded my rails app from 5.2 to 7.0, ransack v 4.0.0 fails to form queries containing the same table twice (ruby 2.7)
Jan 30, 2025
Had the same issue and for me was solved upgrading to version 4.2.1
Currently I try to upgrade my app without upgrading ruby version (2.7). According to rubygems, ransack higher than 4.0.0 works only under ruby 3 or higher. It seems like such upgrade is not possible without ruby 3.
I try to upgrade my rails version without migration to ruby 3. That's why I try to use ransack not higher than 4.0.0.
I have User model with the following associations:
The code below works fine in rails 5.2, but in rails 7 ransack tries to use aliases without actually creating them in left joins.
Rails 5.2 SQL:
Rails 7 SQL:
I tried to downgrade ransack to the one used in rails 5 (2.5.0), but the output remained the same.
Gemflie.lock v 5.2
Gemflie.lock v 7.0
The text was updated successfully, but these errors were encountered: