is it possible to have the controller value in a rails named route as a parameter, which I can pass at runtime to direct the call to the proper controller?
e.g. map.ride 'ride' ,:controller => {some-way-of-specifying-a-parameter}, :action => 'ride'
then at runtime, I want to pass the controller name to which this call should be going. My actions are doing different things depending to which controller the call gets sent. thanks
Thomas' answer is correct, however if you want more flexibility in the URL format you can specify multiple routes and use route requirements by putting :requirements
on each. The route will only match if the requirements are met. For example:
map.resources :rides, :path_prefix => '/:option',
:requirements => { :option => /one/ }, :controller => 'one'
map.resources :rides, :path_prefix => '/:option',
:requirements => { :option => /two/ }, :controller => 'two'
and then:
/one/rides
will go to OneController
/two/rides
will go to TwoController