Using Rails 4, and given the following models:
class Draft < ActiveRecord::Base
has_many :drafters
has_many :users, through: :drafters
end
class Drafter < ActiveRecord::Base
belongs_to :draft
belongs_to :user
end
class User < ActiveRecord::Base
has_many :drafters
has_many :drafts, through: :drafters
end
How can I retrieve all Drafts which are not associated with the User instance current_user
? That is, all Drafts d
for which there is no Drafter belonging to d
and current_user
.
I have Squeel available if it helps.