I have this tipical has_many :through scenario:
class Docs < ActiveRecord::Base
has_many :doc_cats
has_many :categories, :through => :doc_cats
end
class Categories < ActiveRecord::Base
has_many :doc_cats
has_many :docs, :through => :doc_cats
end
class Doc_cats < ActiveRecord::Base
belongs_to :docs
belongs_to :categories
end
Now I would like to get all docs which have (belong to) categories 2 and
4. How to specify find clouse?
@docs = Docs.find(:all, … etc)
by
TheR