UrlRewriter problem in components


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

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' }


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

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
:url => { :params => params.merge(:key => ‘value’)

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

Thanks a lot