where.not

suggest change

where 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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents