Rails routes question. Always find by name and remove /class_name/ from route

Posted by Hock on Stack Overflow See other posts from Stack Overflow or by Hock
Published on 2010-05-23T02:51:54Z Indexed on 2010/05/23 3:00 UTC
Read the original article Hit count: 370

Filed under:
|

I have a Category model and a Product model.

Category has_many products 

and

Product belongs_to Category

I want my routes to be like this:

/:category_type/:category_name/  opens Product#index
/:category_type/  opens Category#show

/ opens Category#index

Is there a way to achieve that with resources? I tried with path_prefix but I just can't get it done.

Any help?

Thanks,

Nicolás Hock Isaza

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routing