instance method
defaults
Ruby on Rails 4.2.9
Since v3.0.20Signature
defaults(defaults = {})
Allows you to set default parameters for a route, such as this:
defaults id: 'home' do match 'scoped_pages/(:id)', to: 'pages#show' end
Using this, the :id parameter here will default to ‘home’.
Parameters
-
defaultsopt = {}
Source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 950
def defaults(defaults = {})
scope(:defaults => defaults) { yield }
end
Defined in actionpack/lib/action_dispatch/routing/mapper.rb line 950
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Routing::Mapper::Scoping