UrlRewriter problem in components

Hi!

It’s not really a big deal, because the workaround is easy, but I don’t
really know if it’s a bug or a feature. Maybe someone can have a look on
that.
I have a problem with creating links within components.

The scenario

My “index” action renders a “list” component by calling:


<%= render_component :action => “list”, :params => params %>

Within this list, I have some navigation links. Those should only change
the content of the list, so I call
link_to_remote “A link”,
:update => ‘list’, :url => { :params => { :key => ‘value’ } }
and receive a completely wrong result.

I did some debugging and found out, that the error happens in
http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/url_rewriter.rb?rev=3534#L44

UrlRewriter calls “Routing::Routes.generate(options.dup, @request)” and
passes @request, which is used for url-generation in next step. I’ve
made some debug output to point up the problem:

puts params
puts @request.path_parameters
puts url_for :params => { :key => 'value' }

returns

{"action"=>"list", "id"=>nil, "controller"=>nil}
{"action"=>"index", "controller"=>"items"}
"items?key=value"

but “url_for” should return “items/list?key=value” instead.

To get it working I use a workaround and always pass all params to the
link
:url => { :params => params.merge(:key => ‘value’)

Is that a bug, or are there any ulterior motives behind that?

Thanks a lot
dave