title: Rails: Preserving GET query string parameters in link_to
body: <p>I have a typical search facility in my app which returns a list of results that can be paginated, sorted, viewed with a different records_per_page value, etc. Each of these options is controlled by parameters in  the query string. A simplified example:</p>
  
  <pre><code>/search?q=test&amp;page=2
  </code></pre>
  
  <p>Now say I need to display a set of links that set records_per_page value to 10, 20, 30. Each link must include the existing query parameters, which can be a very long set, plus a new per_page parameter.</p>
  
  <pre><code>/search?q=test&amp;page=2&amp; ... &amp;per_page=10
  /search?q=test&amp;page=2&amp; ... &amp;per_page=20
  /search?q=test&amp;page=2&amp; ... &amp;per_page=30
  </code></pre>
  
  <p>Is there an easy way to do it with just link_to helper or I need to parse and reproduce the query string from previous request somehow?</p>