Answers for "activerecord exclude"

0

activerecord exclude

post.comments.where.not(id: 1)
# SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = 1 AND "comments"."id" != 1

post.comments.where.not(id: [1, 2])
# SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = 1 AND "comments"."id" NOT IN (1, 2)
Posted by: Guest on January-26-2022

Browse Popular Code Answers by Language