· 1 min read

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'
end

Comments

Leave a comment