Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Document the defaults method

  • Loading branch information...
commit afc16f6dce0447288986ac0b3427fa8d57342a92 1 parent 3551e25
@radar radar authored fxn committed
Showing with 5 additions and 0 deletions.
  1. +5 −0 actionpack/lib/action_dispatch/routing/mapper.rb
View
5 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -502,6 +502,11 @@ def constraints(constraints = {})
scope(:constraints => constraints) { yield }
end
+ # 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'.
def defaults(defaults = {})
scope(:defaults => defaults) { yield }
end
Please sign in to comment.
Something went wrong with that request. Please try again.