Hi,
I have a Category and a Model product with an association table
categories_products.
I want a named that returns the categories with products.
Here is what I've done (in the Category model):
named_scope :with_products, lambda {
{
:joins => "inner join categories_products on (categories.id =
categories_products.category_id)"
}}
The problem with this named_scopes is that it returns X number of the
time the same category. (X is the number of products that the category
as)
What in my named scope I have to add to avoid this?
Greg
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.