diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 15:31:33 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 15:31:33 -0700 |
commit | e852daa6976cc6b6b28ad0c80a188c06e226df3c (patch) | |
tree | 53660e539b370161887c56fca3fe943d9bf7eaed /actionpack/lib | |
parent | 7c6c048f97c981bddbdaf7b763ac9386301071c7 (diff) | |
download | rails-e852daa6976cc6b6b28ad0c80a188c06e226df3c.tar.gz rails-e852daa6976cc6b6b28ad0c80a188c06e226df3c.tar.bz2 rails-e852daa6976cc6b6b28ad0c80a188c06e226df3c.zip |
pull `defaults` extraction up the stack.
Now we can see where `defaults` options originate
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index b13eb1d897..a0d12144c4 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -70,7 +70,7 @@ module ActionDispatch options.delete :shallow_prefix options.delete :shallow - defaults = (scope[:defaults] || {}).merge options.delete(:defaults) || {} + defaults = (scope[:defaults] || {}).dup new scope, set, path, defaults, as, options end @@ -684,7 +684,11 @@ module ActionDispatch def map_method(method, args, &block) options = args.extract_options! options[:via] = method - match(*args, options, &block) + if options.key?(:defaults) + defaults(options.delete(:defaults)) { match(*args, options, &block) } + else + match(*args, options, &block) + end self end end |