Products and categories for e-commerce shop

Hi I have implemented products and categories in the back-end of my e-commerce site. Basically I modelled it like this a product belongs_to a category and a category has many products. So an admin can select a category for a product and it saves correctly. What I would now like to do is show a category with all the products associated with it for example I have a T-shirt category so to show all the T-shirts in the shop. What would I need to change in my application for this to work?

Attachments: http://www.ruby-forum.com/attachment/7187/Store_controller.txt http://www.ruby-forum.com/attachment/7188/db_schema.txt http://www.ruby-forum.com/attachment/7189/product_model.rtf http://www.ruby-forum.com/attachment/7190/product_model.txt http://www.ruby-forum.com/attachment/7191/category_model.txt

Hi I have implemented products and categories in the back-end of my e-commerce site. Basically I modelled it like this a product belongs_to a category and a category has many products. So an admin can select a category for a product and it saves correctly. What I would now like to do is show a category with all the products associated with it for example I have a T-shirt category so to show all the T-shirts in the shop. What would I need to change in my application for this to work?

You don't need to post your whole app for such a simple question. If you have a category in @category for example, then the products for that category are just @category.products so you can just loop through them displaying what you want.

Colin