Skip to content

Instantly share code, notes, and snippets.

@pixeltrix
Created October 23, 2013 07:40
Show Gist options
  • Save pixeltrix/7114147 to your computer and use it in GitHub Desktop.
Save pixeltrix/7114147 to your computer and use it in GitHub Desktop.
The `format: false` removes the optional segment from the end of the route but doesn't affect any path parameters so you need the regexp constraint to allow matching on periods.
NoFormatTest::Application.routes.draw do
root 'root#index'
scope '/foo/:bar', format: false, bar: /[^\/\?]+/ do
get '/', to: 'root#index'
get '/baz', to: 'root#index'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment