This project is archived and is in readonly mode.
Route generation error with :defaults and :via options
Reported by BicycleRepairMan | September 19th, 2010 @ 04:14 PM | in 3.0.6
There seems to be a problem when we use the :defaults and :via options simultaneously to match a route. The attached unit test should not fail! Also if the routes.rb file looks like
RouteBug::Application.routes.draw do
match '/error' => "bug#index", :defaults => {:format => "jpg"}, :via => :get
end
then
RAILS_ENV=env rails runner 'RouteBug::Application.routes.generate :controller => :bug'
raises an error in test and production mode, but not in development
mode.
I tested this with ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] compiled from source and the ubuntu lucid ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux].
Comments and changes to this ticket
-
Andrew White September 19th, 2010 @ 10:39 PM
- Milestone cleared.
- State changed from new to open
- Assigned user set to josh
- Importance changed from to Low
This is another subtle Rack::Mount bug to do with key analysis. The reason it doesn't work in test or production is that the built-in info route isn't included and this is enough to trigger the bug. If you add some additional routes inside the test it passes.
It looks as though :format is getting added to the generation_keys array because the :request_method condition is including it in required_defaults. Once you have other routes the :format key drops out of generation_keys due to the increased frequency of the :controller and :action keys.
-
Ryan Bigg October 16th, 2010 @ 02:22 AM
- Tag changed from sheepskin boots, routes to routes
Automatic cleanup of spam.
-
Santiago Pastorino February 27th, 2011 @ 03:15 AM
- Milestone changed from 3.0.5 to 3.0.6
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>