where.not
suggest changewhere clauses can be negated using the where.not syntax:
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')
Supported by ActiveRecord 4.0 and later.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents