Home Can I customize the `resources` helper in my routes to use a parameter other than \:id?
Reply: 0

Can I customize the `resources` helper in my routes to use a parameter other than \:id?

user616
1#
user616 Published in June 20, 2018, 7:21 am

I have a route that looks like this:

get '/sell/:ticker', to: 'sell#new', as: 'sell'

That does what I want, which is allows get requests to myapp.com/sell/ABC.

I have another route, resources :stocks that I would also like to be able to specify for it to use /:ticker, rather than /:id in all the routes.

Is there some way for me to modify the resources helper to use \:ticker rather than \:id, without having to write every route individually?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.489703 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO