Ruby on Rails ActiveRecord Query Interface where.not


Example

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.