I have a controller with a number of static pages and I would ideally like to route them all with a wildcard.
Is it possible to do something like the following?
get 'static/:action'
I have a controller with a number of static pages and I would ideally like to route them all with a wildcard.
Is it possible to do something like the following?
get 'static/:action'
You probably need something like
get 'static/:action', to: 'static#show'
and then in yourStaticController
show action render the correct static page based on theparams[:action]
parameter.See http://guides.rubyonrails.org/routing.html#defining-defaults for more.
You can route something like
Why don't you just use the
show
action:This way, you can pass the "page" directly through the link and have it all handled by Rails: