aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb6
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb2
2 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 46163706c3..40e30bca6f 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -35,13 +35,15 @@ module ActionDispatch
end
def root(options = {})
+ raise "Can't rename root to #{options[:as].inspect}: root is always named 'root'" if options.include?(:as)
match '/', options.merge(:as => :root)
end
def match(*args)
if args.one? && args.first.is_a?(Hash)
- path = args.first.keys.first
- options = { :to => args.first.values.first }
+ options = args.first
+ path = options.keys.first
+ options[:to] = options.delete(path)
else
path = args.first
options = args.extract_options!
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index a4dc5e0956..498ad3268c 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -273,7 +273,7 @@ module ActionDispatch
# TODO: Move this into Railties
if defined?(Rails.application)
# Find namespaces in controllers/ directory
- Rails.application.configuration.controller_paths.each do |load_path|
+ Rails.application.config.controller_paths.each do |load_path|
load_path = File.expand_path(load_path)
Dir["#{load_path}/**/*_controller.rb"].collect do |path|
namespaces << File.dirname(path).sub(/#{load_path}\/?/, '')