Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Dashes for urls in ruby on rails

I have a view folder product_types. The name of the controller file is product_types_controller and the class I have is ProductTypesController. I'd normally keep the _ format that rails prefers but I need to keep the current page syntax for search index reasons.

How do I get this controller to show up for mysite.com/product-types and all pages in the folder product_types to appear for mysite.com/product-types/some-page? Do I need to name the pages with - or should I use the _ syntax as well and just change the routes.

This is for a Rails 2.3.8 site.

Thanks

like image 389
Splashlin Avatar asked Dec 10 '22 12:12

Splashlin


1 Answers

For Rails 3 you have to do this differently:

resources "product-types", :as => :product_types, :controller => :product_types
like image 51
Matt Crouch Avatar answered Dec 26 '22 10:12

Matt Crouch