Thursday, 22 August 2013

Why are ampersands escaped when generating url with link_to?

Why are ampersands escaped when generating url with link_to?

Here is my simple rails 3 code :
<%= link_to "link", gateway_index_url(developer:@item.developer.api_key,
tracker:"email", url:@product.url) %>
And the result is :
<a
href="/gateway?developer=abcde&amp;tracker=email&amp;url=http%3A%2F%2Fwww.bla.fr%2FproductA"
>link</a>
The problem is that & are rewritten in &amp;. I can't figure how to
prevent escaping, as :escape => false doesn't exist in Rails 3

No comments:

Post a Comment