aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-10 15:20:33 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-10 15:20:33 -0700
commit7c6c048f97c981bddbdaf7b763ac9386301071c7 (patch)
tree527a32a06c74badbcbfacbabb7e070fa1ef55696
parentd193b3bbf6459e7684bd531df49f877803aadd0a (diff)
downloadrails-7c6c048f97c981bddbdaf7b763ac9386301071c7.tar.gz
rails-7c6c048f97c981bddbdaf7b763ac9386301071c7.tar.bz2
rails-7c6c048f97c981bddbdaf7b763ac9386301071c7.zip
avoid calling `scope` on `defaults` methods
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 3f43bfdc56..b13eb1d897 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -787,8 +787,8 @@ module ActionDispatch
end
if options[:constraints].is_a?(Hash)
- defaults = options[:constraints].select do
- |k, v| URL_OPTIONS.include?(k) && (v.is_a?(String) || v.is_a?(Fixnum))
+ defaults = options[:constraints].select do |k, v|
+ URL_OPTIONS.include?(k) && (v.is_a?(String) || v.is_a?(Fixnum))
end
(options[:defaults] ||= {}).reverse_merge!(defaults)
@@ -946,7 +946,10 @@ module ActionDispatch
# end
# Using this, the +:id+ parameter here will default to 'home'.
def defaults(defaults = {})
- scope(:defaults => defaults) { yield }
+ @scope = @scope.new(defaults: merge_defaults_scope(@scope[:defaults], defaults))
+ yield
+ ensure
+ @scope = @scope.parent
end
private