Hello,

I've run across an issue with namespaced controllers and url generation.

>From 
>http://github.com/rails/rails/tree/master/actionpack/lib/action_controller/routing/route_set.rb
(line 322) I'm wondering what the purpose of the section of code with
this comment is:

# if the controller has changed, make sure it changes relative to the
# current controller module, if any. In other words, if we're currently
# on admin/get, and the new controller is 'set', the new controller
# should really be admin/set.

My scenario is the following...

I have view layout code with link_to's the use a hash to specify the url

link_to 'Example', {:controller => 'nonamespace', :action => 'index'}

which generates "/nonamespace"

But when I access a controller that is namespaced such as
"/namespace/blah/action", that same link_to now generates
"/namespace/nonamespace"

So from what I can tell the routing code is making an assumption that
I don't think it should which seems to be that generated urls
(sepcified with a hash) should remain in the context of the current
views controller.  In my case it's code for a layout which can apply
to many controllers, so this assumption is incorrect and causing this
issue.

Can somebody explain the assumption made by the routing code and if
this is indeed a bug?

Thanks,
Andrew

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to