aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/routing
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-01-26 08:41:19 +0000
committerMichael Koziarski <michael@koziarski.com>2008-01-26 08:41:19 +0000
commit6e165b894051a23c2818cb8d21dd74de8d41c622 (patch)
tree04054b28ad0f83e843336c5d4bd7f46f06fd5cd7 /actionpack/lib/action_controller/routing
parent07132865d69cda80feba26827d3de9fe19365876 (diff)
downloadrails-6e165b894051a23c2818cb8d21dd74de8d41c622.tar.gz
rails-6e165b894051a23c2818cb8d21dd74de8d41c622.tar.bz2
rails-6e165b894051a23c2818cb8d21dd74de8d41c622.zip
Make it simpler to make the root route an alias for another route. Closes #10818 [bscofield]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8738 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/routing')
-rw-r--r--actionpack/lib/action_controller/routing/route_set.rb5
1 files changed, 5 insertions, 0 deletions
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