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
For me the example only worked when i added .project(Arel.star) before .exists, so it would look like this:
scope:with_any_role_ids,lambda{ |role_ids|
# get a reference to the join tablerole_assignments=RoleAssignment.arel_table# get a reference to the filtered tablestudents=Student.arel_table# let AREL generate a complex SQL querywhere(RoleAssignment \
.where(role_assignments[:student_id].eq(students[:id])) \
.where(role_assignments[:role_id].in([*role_ids].map(&:to_i))) \
.project(Arel.star) \
.exists)}
Not sure if it's only in my usecase, but without it I got sql syntax error.
The text was updated successfully, but these errors were encountered:
For me the example only worked when i added .project(Arel.star) before .exists, so it would look like this:
Not sure if it's only in my usecase, but without it I got sql syntax error.
The text was updated successfully, but these errors were encountered: