I've noticed the new behavior that was not seen in stable Rails.
Using edge Rails I observe the following problem.
Example situation:
- user is executing GET request to /sprint/show/205
- there's a route:
map.connect 'sprint/show/:sprint', :controller => 'task', :action => 'index'
- in task/index.rhtml template we have:
<%= link_to "Break Me", :action => 'foo', :params => { :sprint => 1 } %>
or
<%= link_to "Break Me", :action => 'foo', :sprint => 1 %>
Problem:
- on generated page the link is: <a href="/task/foo">Break Me</a> without the sprint parameter
Why?
- url_for is used to build the URL
- url_for calls the URL rewriter (UrlRewriter::rewrite_path) to get the URL path string
- rewriter asks the request about path parameters and in our case it gets
{:controller => 'task', :action => 'index', :sprint => 205 }
- rewriter asks the route to generate the url by passing path parameters as "recall" argument to Route::generate(options, recall, method)
- generate method "recalls" those from the path, including "sprint" which is wrong in this case!
The conclusion is that in edge Rails parameters to the url_for can not have
the same name as symbols in the route.