This project is archived and is in readonly mode.
Last Request no longer respected (AWDwR3, section 21.2)
Reported by Sam Ruby | October 21st, 2009 @ 05:03 PM | in 3.0.2
Symptoms:
rs = ActionController::Routing::Routes
last_request = rs.recognize_path "/blog/2006/07/28"
rs.generate({:year => 2006}, last_request)
2.3.3 => "/blog/2006/07/28"
2.3.4 => /blog/show_date?year=2006"
3.0pre => "/blog/2006"
Note: the issue isn't that it isn't picking the "optimum" URI, the issue is that it isn't picking one that matches the last_request.
Comments and changes to this ticket
-
josh October 21st, 2009 @ 07:15 PM
- Milestone cleared.
Can you please post the route configuration.
Also, both "recognize" and "recognize_path" are deprecated apis. I'm going put a notice in 2.3.x in favor of only providing the "call" api for recognizing routes.
-
Sam Ruby October 21st, 2009 @ 08:31 PM
Here is the entire script: http://github.com/rubys/awdwr/raw/master/data/code/e1/routing/confi...
You can run it from an empty rails project, using either script/console or irb.
The output from the run can be found at (ruby 1.8.7 and ruby 1.9.2 respectively):
http://intertwingly.net/projects/AWDwR3/checkdepot.html#section-21.2
http://intertwingly.net/projects/AWDwR3/checkdepot-rvm-1.9.2.html#s...I don't see any deprecation warnings produced. I am open to any suggestions as to better APIs that provide the same basic abilities to manipulate and explore routes. I don't understand the reference to the "call" api.
For references, here is comparable output from Rails 2.3.2:
http://intertwingly.net/projects/AWDwR3/checkdepot-2.3.2.html#secti...
-
Jeremy Kemper November 8th, 2009 @ 08:38 PM
- State changed from new to open
-
josh November 10th, 2009 @ 04:19 AM
I added a pending test based on your AWD test case.
http://github.com/rails/rails/commit/e9d21ca903adbcfaae5ac37a1a46db...
-
josh December 6th, 2009 @ 09:48 PM
- State changed from open to wontfix
I think we're just going settle on breaking backwards compatibility here.
map.connect "blog/:year/:month/:day", :controller => "blog", :action => "show_date", :requirements => { :year => /(19|20)\d\d/, :month => /[01]?\d/, :day => /[0-3]?\d/}, :day => nil, :month => nil
:year, :month, and :day are all optional segments. It will not use last_request/recalled params to fill in optional segments. This is generally the policy of the old router. However passing in :day and :month with nil cause some weird quirks. This behavior was never officially doc or ever tested. It just happened to work.
Relying on this nil quirk to force recalled params to be used will be deprecated in 3.0.
Sam, ping me on CF if you want to discuss further.
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to
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>