Is this a bug in routes, or something I’m doing wrong. Basically from what I can tell the url_for being generated in the case where my existing controller had a
forward slash (i.e. active_rbac/login) may be causing a problem. I’m creating a link to a different controller however the URL created has a piece of the previous controller in it (i.e. active_rbac/). I put a breakpoint in the view and the run the following to confirm, see below. Also note the login aspects use a plugin.
I’m still battling this one and am yet unsure whether this
is a bug or not. It would be great if someone could put me out of my
misery and confirm whether this is bug or not?
With the latest
testing to characterise the problem it seems to be something to do with
(a) controllers a sub-directory down &/or (b) url_for usage in a layout perhaps. That is in the sense that I have a "
url_for" which resolves fine when the context is one controller but throws an error when in the context of another.
Key points include:
routes.rb routes a URL to a controller which is down 1 subdirectory - Example
map.connect ‘:locale/mygoodness’, :controller => ‘highlevel/midlevel’, :action => ‘testaction’, :defaults => {:locale => nil}
The
site_layout link is generator OK when it is used from the opening page,
BUT when it is utilised after a URL has come in via the controller
which is down a sub-directory (
i.e. 'highlevel/midlevel) an error is encountered. See below.
Note the hash indicated in the error below has ":controller=>" highlevel/contacts" and it has seemed to munge the “highlevel/midlevel” controller name with the “contacts” controller name.
Interestingly if I change the “url_for” line in the layout to:
<%= link_to "2-contacts “, :controller => nil %> one sees the following in the error `:controller=>”
highlevel/highlevel/midlevel"
`
<%= link_to "2-contacts ", :controller => “” %> one sees the following in the error