Method: ActionDispatch::Routing::Mapper::Scoping#defaults

Defined in:
lib/action_dispatch/routing/mapper.rb

#defaults(defaults = {}) ⇒ Object

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’.



690
691
692
# File 'lib/action_dispatch/routing/mapper.rb', line 690

def defaults(defaults = {})
  scope(:defaults => defaults) { yield }
end