Skip to content

Commit

Permalink
pull defaults extraction up the stack.
Browse files Browse the repository at this point in the history
Now we can see where `defaults` options originate
  • Loading branch information
tenderlove committed Aug 10, 2015
1 parent 7c6c048 commit e852daa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions actionpack/lib/action_dispatch/routing/mapper.rb
Expand Up @@ -70,7 +70,7 @@ def self.build(scope, set, path, as, options)
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
Expand Down Expand Up @@ -684,7 +684,11 @@ def delete(*args, &block)
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
Expand Down

0 comments on commit e852daa

Please sign in to comment.