I''m no expect, but I''ve done things like:
@category_product_pages, @category_products = paginate :products,
:per_page => 10, :conditions => ["category = ?", @category.id]
christian ma wrote:> I''m struggling with the issue of pagination and many to many 
> relationships.
> 
> I have products and categories (a many to many relationship.)
> 
> When I go to a category page, I wish to load all products associated 
> with that category and have pagination of the products.
> 
> @category_products = @category.products gives me all the products 
> associated with the category however, when I try to setup pagination:
> 
> @category_product_pages, @category_products = paginate :products, 
> :per_page => 10
> 
> I get back all the products no matter what category I''m in.
I''m assuming
> it is because :products is just returning all products in the database. 
> What should I be using instead?
> 
> Help! (this is my third day on rails).
-- 
Posted via http://www.ruby-forum.com/.