small medium large xlarge

Generic-user-small
21 Feb 2011, 23:59
Sylvain Bellino (3 posts)

Using the shop from the book i created a product_type model.

A product belongs_to product_typr and a product_type has_many product.

the best thing i managed to do is that :

controller :shop do get “shop” => “shop#index” end

in routes and :

<%= link_to product_type.name, shop_path(product_type) %>

for the link directing to shop

Please i really really need some help here, i am trying to do it since 4 days and i asked in a lot of forums without any solution.

Generic-user-small
22 Feb 2011, 01:34
Steve Castaneda (11 posts)

I think the first thing you’ll want to do is revise that route.

match ‘shop’ => ‘shop#index’

This will allow you to reference root_path/shop, which will point to your index method in the shop controller.

Are you trying to reference a shop by providing a product_type? So a shop has_many product_types?

You must be logged in to comment