diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-23 17:42:30 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-23 17:42:30 -0800 |
commit | 4d3602a8c4b38052c70655cd7d9dea42ae10ea8d (patch) | |
tree | 8687cdd687cde9ddb27315c1a676901d1d50098a /actionpack/lib/action_dispatch/routing | |
parent | 1ee50e58f6eb429872dfeabeb0708a8065ff34de (diff) | |
download | rails-4d3602a8c4b38052c70655cd7d9dea42ae10ea8d.tar.gz rails-4d3602a8c4b38052c70655cd7d9dea42ae10ea8d.tar.bz2 rails-4d3602a8c4b38052c70655cd7d9dea42ae10ea8d.zip |
Routing: fix that route shorthand shouldn't ignore other options. Raise if :as option is given to root method since its name is always 'root'
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 |
1 files changed, 4 insertions, 2 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! |