I have three models
class Collection < ActiveRecord::Base
has_many :presentations
has_many :galleries, :through => :presentations
end
class Gallery < ActiveRecord::Base
has_many :presentations
has_many :collections, :through => :presentations
end
class Presentation < ActiveRecord::Base
belongs_to :collection
belongs_to :gallery
end
How do I get all the collections that do not belong to a given gallery?
My SQL knowledge is only rudimentary. I also want to let Rails (2.3) do the work without using explicitly a SQL expression.