Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

How To Add A Route With A Forward Slash in Params with Rails 3 Application


Use an asterisk in the pattern to match for everything after it. In the example below, date will be available in the params hash as params[:date].

SPB::Application.routes.draw do
  # http://example.com/calendar/2007/10 
  # params[:date] => "2007/10"
  match '/calendar/*date' => 'events#index', as: 'month'
Tagged w/ #ruby on rails #routes #code samples