find all that are nil in the association in ruby on rails

Viewed 8373

Here I've got a 1-to-many relationship between Products and Users:

class Property < ActiveRecord::Base
  has_many :users
end

class User < ActiveRecord::Base
  belongs_to :property
end

How could I get all the properties which do not belong to any user?

6 Answers
Related