Skip to content

Instantly share code, notes, and snippets.

@robertsosinski
Created April 6, 2009 14:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robertsosinski/90782 to your computer and use it in GitHub Desktop.
Save robertsosinski/90782 to your computer and use it in GitHub Desktop.
A simple way to manage multiple parameters in Rails routing
before_filter :hash_options
def hash_options
params[:options] = Hash[*((params[:options].size % 2) == 0) ? params[:options] : (params[:options] + [nil])] if params[:options]
end
map.connect ':controller/:action/*options'
<a href="/pages/show/<%= "user_name/#{@user_name}/date/#{@date}" %>">Link</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment