How to add parameters to current URL in rails

In order to preserve the params I did this:

<%= link_to 'Date', params.merge(sort: "end_date") %>

However the url will be ugly.

UPDATE

For Rails 5 use:

<%= link_to 'Date', request.params.merge(sort: "end_date") %>

If you only need one cgi param and want to stay on the same page, this is very simple to achieve:

<%= link_to "lowest prices", :sort => "price_lowest" %>

However, if you have more than one, you need some logic to keep old ones. It'd probably be best extracted to a helper, but essentially you could do something like this to keep the other params..

<%= link_to "lowest prices", :sort => "price_lowest", :other_param => params[:other] %>

Named routes will only really help you here if you need to go to another page.