Activerecord Wyklucz

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)
Lioruby