Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try:</p> <pre><code>+ "?direction=desc".html_safe </code></pre> <p>Edit: Since you're using rails 2.3.5, try this:</p> <pre><code>def search_sort(name, sort_by, order = 'asc') link_to(name, url_for(:overwrite_params =&gt; { :order_by =&gt; sort_by + "?direction=desc" :page =&gt; nil }, :escape =&gt; false), :class =&gt; 'selected save_pushstate') ... </code></pre> <p>Note the ":escape => false" in url_for.</p> <p>Edit2: After reading this: <a href="http://www.ruby-forum.com/topic/80381" rel="nofollow">http://www.ruby-forum.com/topic/80381</a></p> <p>Specifically this excerpt:</p> <blockquote> <p>I think this is where the confusion is arising. There are two different kinds of escaping going on.</p> <p>It sounds like you're talking about the URL encoding that uses '%xx' to represent special characters.</p> <p>However, the html_escape function does something completely different. It takes a string and turns '&amp;' into '&amp;' and '&lt;' into '&lt;', etc., so that it can go into HTML without being interpreted as literal '&amp;'s and '&lt;'s.</p> <p>Escaping special characters in URLs using the '%xx' scheme is mandatory, otherwise they are not valid URLs.</p> </blockquote> <p>I've realized that the 'escaping' that you see happening is url encoding, and it shouldn't affect your query/sorting, etc. You can test it out by taking the encoded url and typing it into your browser.</p> <p>:escape => false disable html escaping, which means dangerous characters get converted to display codes, such as '&amp;' into '&amp;' and '&lt;' into '&lt;', etc.,</p> <p>And the "?" in your append should be "&amp;":</p> <pre><code>+ "&amp;direction=desc" </code></pre> <p>Hope this helps. =)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload