This should be very clear to me, but for some reason it’s not, and I
can’t seem to find any examples that help me. My models looks like this:
class Product < ActiveRecord::Base
has_many :company_products
end
class CompanyProduct < ActiveRecord::Base
belongs_to :product
end
How do I find all Product records that have a CompanyProduct.company_id
of, say 36?
I suppose I could do a find_all statement with an include, but it seems
there should be a much easier, ready-made ActiveRecord solution rather
than creating my very own joins. How would that work?