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]
end
Now when you write a linkto inside of your application, if the params[:paramvalue] exists then it will be automatically appended
Written by dennis monsewicz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#