Ronan Lopes
Ronan Lopes

Reputation: 3398

Rails routes resources - add extra param on all routes

I wanna generate some routes for my scaffold, but in some way that all of then looks something like:

/companys/:type
/companys/:type/new
/companys/:type/:id/edit

so I can catch that "type" param on my controllers. I don't wanna do it manually... Is there some way to easily add that :type param? Thanks!

Upvotes: 1

Views: 82

Answers (1)

Alexandre Angelim
Alexandre Angelim

Reputation: 6753

resources :companys, path: '/companys/:type'

It's worth nothing that the inflector will pluralize company to companies instead of companys.

Upvotes: 3

Related Questions