views:

69

answers:

1

I have Product model and it has many categories with a has_many :through association

In my controller I am trying to do a find by with categories.category but it comes up with a mysql error.

Model.find(:all, :conditions => ['categories.category_id = ?', @category.id ])

Ideas?

A: 

If you're doing you're find on the Product model, you're either going to need to remove the categories. part of your :conditions statement, or add a :joins => :categroies to your finder.

Some more help would certainly narrow down the problem, however.

jerhinesmith
This work. Thanks!
Sam