Last Updated: February 25, 2016
· dennismonsewicz

Persistant URL Params in Rails

Recently I was working on a project that needed the ability to carry a single parameter from page to page. Here is how you can achieve this:

Open up your ApplicationController and place this method inside of it:

def url_options
  {:key => params[:param_value]}.merge(super) if params[:param_value]

Now when you write a linkto inside of your application, if the params[:paramvalue] exists then it will be automatically appended