Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Last Request no longer respected (AWDwR3, section 21.2)

#3403

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.

Reported by Sam Ruby · October 21st, 2009 @ 05:03 PM

State: wontfix
Milestone: 3.0.2
Assigned to: josh josh
Importance: none

Activity

  1. josh
    josh
    • 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.

    October 21st, 2009 @ 07:15 PM

  2. Sam Ruby
    Sam Ruby

    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...

    October 21st, 2009 @ 08:31 PM

  3. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to open

    November 8th, 2009 @ 08:38 PM

  4. josh
  5. josh
    josh
    • 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.

    December 6th, 2009 @ 09:48 PM

  6. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to

    October 15th, 2010 @ 11:01 PM