Possible Duplicate:
Rails: How do I pass custom params to a controller method?
I am wondering if it possible to pass parameter to controller action through routes. I have a one generic action method which I want to call for various routes. No, I can't use wildcard in my route.
match '/about' => 'pages#show'
match '/terms' => 'pages#show'
match '/privacy' => 'pages#show'
I am looking for something like:
match '/about' => 'pages#show', :path => "about"
match '/terms' => 'pages#show', :path => "terms"
match '/privacy' => 'pages#show', :path => "privacy"
Thanks.
Try
match '/about' => 'pages#show', :defaults => { :id => 'about' }
match '/terms' => 'pages#show', :defaults => { :id => 'terms' }
match '/privacy' => 'pages#show', :defaults => { :id => 'privacy' }
if you can't for some reason just follow the standard convention of
match '/:id' => 'pages#show'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With