diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/routing/route_set.rb | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index d93dc5205f..70745f9d27 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -115,6 +115,12 @@ module ActionController # root_url # => 'http://www.example.com/' # root_path # => '' # + # You can also specify an already-defined named route in your map.root call: + # + # # In routes.rb + # map.new_session :controller => 'sessions', :action => 'new' + # map.root :new_session + # # Note: when using +with_options+, the route is simply named after the # method you call on the block parameter rather than map. # diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb index 30995297f3..6ba1a5c3ea 100644 --- a/actionpack/lib/action_controller/routing/route_set.rb +++ b/actionpack/lib/action_controller/routing/route_set.rb @@ -19,6 +19,11 @@ module ActionController # Creates a named route called "root" for matching the root level request. def root(options = {}) + if options.is_a?(Symbol) + if source_route = @set.named_routes.routes[options] + options = source_route.defaults.merge({ :conditions => source_route.conditions }) + end + end named_route("root", '', options) end |