Remote_function double escapes string in options[:url]


#1

I don’t know if this is a known issue:

When passed a string as url remote_function double escapes it.
Escaping is only disabled for hashes:

File vendor/rails/actionpack/lib/action_view/helpers/

prototype_helper.rb
223: def remote_function(options)
[…]
240: url_options = options[:url]
241: url_options = url_options.merge(:escape => false) if
url_options.is_a?(Hash)
242: function << “’#{url_for(url_options)}’”

This breaks the query string in urls which are genereated via named
routes. Example:

link_to_remote ‘User’, :url => user_path(:id => user, :a => 1, :b =>
2)

becomes:

<a href="#" onclick="new Ajax.Request(’/users/1?a=1&amp;b=2’ […]

Hence the parameter b is turned into amp;b.

Using hash_for_ helpers circumvents the problem.