where.not
使用 where.not
語法可以取消 where
子句:
class Person < ApplicationRecord
#attribute :first_name, :string
end
people = Person.where.not(first_name: ['Mark', 'Mary'])
# => SELECT "people".* FROM "people" WHERE "people"."first_name" NOT IN ('Mark', 'Mary')
由 ActiveRecord 4.0 及更高版本支援。