This project is archived and is in readonly mode.
route generation fails with :module written in Symbol
Reported by Daisuke Fujimura | June 18th, 2010 @ 01:37 PM
Named route is not generated since a Symbol defining module name won't be converted to String.
This might be a regression caused by commit:6db9558416cf2133adacbe1634f28c25bfe618d6
I attached a patch to fix this with a test.
This is a stack trace with my app which where working just
before the commit above.
name_for_action': undefined methodtr' for :users:Symbol
(NoMethodError)
$ rake test (in /home/fujimura/a_project)
/home/fujimura/src/rails/actionpack/lib/action_dispatch/routing/mapper.rb:874:in
from /home/fujimura/src/rails/actionpack/lib/action_dispatch/routing/mapper.rb:868:in `options_for_action'
from /home/fujimura/src/rails/actionpack/lib/action_dispatch/routing/mapper.rb:722:in `match'
from /home/fujimura/src/rails/actionpack/lib/action_dispatch/routing/mapper.rb:287:in `map_method'
from /home/fujimura/src/rails/actionpack/lib/action_dispatch/routing/mapper.rb:239:in `get'
from /home/fujimura/a_project/config/routes.rb:38
Comments and changes to this ticket
-
Andrew White June 18th, 2010 @ 05:35 PM
Daisuke, the same problem occurs in the nested scope as well - can you fix it there and upload a new patch (with extra tests for the nested scope)?
Failing routes:
scope(:module => :admin) do resources :products do resources :images end end
-
Andrew White June 19th, 2010 @ 01:02 PM
- Assigned user set to Jeremy Kemper
Actually, don't bother Daisuke - this is actually a symptom of a deeper problem. I was using :module to try and determine the shallow path and name prefix. As your example illustrates :module may not actually be part of the namespace so it needs to be fixed in a different way.
The attached patch fixes this problem by tracking the shallow path and name prefix properly and modifies an existing test route to use a symbol for :module so that we don't get a regression.
-
Repository June 19th, 2010 @ 11:19 PM
- State changed from new to resolved
(from [1f84061c5c271647dc5f7f1311e365e134130e0f]) Don't use module to work out shallow name prefix and path as it may not accurately reflect the actual namespace [#4899 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/1f84061c5c271647dc5f7f1311e365...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4899 route generation fails with :module written in Symbol (from [1f84061c5c271647dc5f7f1311e365e134130e0f]) Don't u...