Given the ruby code in the script, I would expect user.groups
to be scoped by both of the deleted_at
conditions. This was the behavior up thru Rails f55c60f
. This was changed in bc6ac8 to fix a regression. This issue persists thru master.
Rails f55c60f
SELECT "groups".*
FROM "groups"
INNER JOIN "assignments"
ON "groups"."id" = "assignments"."assignable_id"
WHERE "assignments"."deleted_at" IS NULL -- This is the missing clause
AND "assignments"."user_id" = 1