Reputation: 149
I want to do something like:
namespace :dashboard do
get 'speed'
get 'engine'
get 'oil'
get 'errors', :to => 'warn_system#errors', :module => false
end
Only errors link to another controller.
dashboard_speed GET /dashboard/speed(.:format) dashboard#speed
dashboard_oil GET /dashboard/oil(.:format) dashboard#oil
dashboard_engine GET /dashboard/engine(.:format) dashboard#engine
dashboard_errors GET /dashboard/errors(.:format) dashboard/warn_system#errors {:module=>false}
For the last record, I want it to be
dashboard_errors GET /dashboard/errors(.:format) warn_system#errors
What shall I do? I am using Rails 3 if it matters.
Upvotes: 0
Views: 222
Reputation: 24367
To route to a different controller within a namespace specify the absolute path to the controller. If the warn_system controller is in the root namespace use:
namespace :dashboard do
get 'errors', :to => '/warn_system#errors'
end
Update:
Based on your comment it looks like you want to use:
namespace :dashboard do
get 'errors', :to => '/dashboard/warn_system#errors'
end
Upvotes: 0
Reputation: 1954
For Rails 3, try this:
scope '/dashboard' do
get 'errors', :to => 'warn_system#errors'
end
Upvotes: 1