aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-03-16 09:15:52 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2014-03-16 09:35:35 +0000
commitbb0518891c4c7cc40ff01d90983b83beb61242af (patch)
tree10b9f7ed28eb6cfdd968c7c6bb6a8fa3a8b1421f /actionpack/lib/action_dispatch/routing/mapper.rb
parentaf981764686c28db40305adf9cfc308f2e20ab50 (diff)
downloadrails-bb0518891c4c7cc40ff01d90983b83beb61242af.tar.gz
rails-bb0518891c4c7cc40ff01d90983b83beb61242af.tar.bz2
rails-bb0518891c4c7cc40ff01d90983b83beb61242af.zip
Use nested_scope? not shallow? to determine whether to copy options
The method `shallow?` returns false if the parent resource is a singleton so we need to check if we're not inside a nested scope before copying the :path and :as options to their shallow equivalents. Fixes #14388.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 357829e59f..5de0a0cbc6 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -707,7 +707,7 @@ module ActionDispatch
options[:path] = args.flatten.join('/') if args.any?
options[:constraints] ||= {}
- unless shallow?
+ unless nested_scope?
options[:shallow_path] ||= options[:path] if options.key?(:path)
options[:shallow_prefix] ||= options[:as] if options.key?(:as)
end
@@ -1547,6 +1547,10 @@ module ActionDispatch
RESOURCE_METHOD_SCOPES.include? @scope[:scope_level]
end
+ def nested_scope? #:nodoc:
+ @scope[:scope_level] == :nested
+ end
+
def with_exclusive_scope
begin
old_name_prefix, old_path = @scope[:as], @scope[:path]