From 5f7f3adccd2ddc1d307e4e5ea4a323562b1cf7ff Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sun, 7 Nov 2010 10:42:33 +1000 Subject: Document the defaults method --- actionpack/lib/action_dispatch/routing/mapper.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 9ff7481c1f..e760eb0196 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -534,6 +534,11 @@ module ActionDispatch 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 -- cgit v1.2.3