Last Updated: February 25, 2016
· dennismonsewicz
392321 692815809906 50504925 33878144 117300072 n

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

Say Thanks