Forum: Ruby on Rails route to a controller outside of a namespace

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Scott N. (Guest)
on 2009-01-09 19:01
(Received via mailing list)
i have a couple controller namespaces in my app and to keep things
DRY, i would like to use a common controller in some of them.

when i try creating a route, i can not figure out how to
set :controller to use a controller outside of the namespace.

map.namespace :user do |user|
  user.resource :something, :controller => "something"
  user.resource :something2, :controller => "/something2"

 {:action=>"show", :controller=>"user/something"}
 {:action=>"show", :controller=>"user//something2"}

i want
 {:action=>"show", :controller=>"something"}

is there a way to tell rails not to automatically add the "user/" to
the beginning of the controller name?

i guess i could create a blank User::Something controller that
inherits from the Something controller, but it seems silly to have to
create an extra controller.
This topic is locked and can not be replied to.