aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-09 17:11:33 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-09 17:11:43 -0700
commit919e7d3e6cfff09c9da34c09b8938c34f653c477 (patch)
treead1863bf9c49a05877460bb628aaeac391c6ae9c /actionpack/lib/action_dispatch/routing/mapper.rb
parent644c4efdc9e1273ed61c71196e81b52376161ad5 (diff)
downloadrails-919e7d3e6cfff09c9da34c09b8938c34f653c477.tar.gz
rails-919e7d3e6cfff09c9da34c09b8938c34f653c477.tar.bz2
rails-919e7d3e6cfff09c9da34c09b8938c34f653c477.zip
push `scope` calls up one frame
eliminates calling `scope` in one method, pushes the other calls up one frame. This goes a little way towards eliminating the internal calls to `scope`.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 1264e7e00b..e047d57ac7 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1421,7 +1421,9 @@ module ActionDispatch
with_scope_level(:member) do
if shallow?
- shallow_scope(parent_resource.member_scope) { yield }
+ shallow_scope {
+ path_scope(parent_resource.member_scope) { yield }
+ }
else
path_scope(parent_resource.member_scope) { yield }
end
@@ -1447,9 +1449,15 @@ module ActionDispatch
with_scope_level(:nested) do
if shallow? && shallow_nesting_depth >= 1
- shallow_scope(parent_resource.nested_scope, nested_options) { yield }
+ shallow_scope do
+ path_scope(parent_resource.nested_scope) do
+ scope(nested_options) { yield }
+ end
+ end
else
- scope(parent_resource.nested_scope, nested_options) { yield }
+ path_scope(parent_resource.nested_scope) do
+ scope(nested_options) { yield }
+ end
end
end
end
@@ -1720,12 +1728,12 @@ module ActionDispatch
resource_method_scope? && CANONICAL_ACTIONS.include?(action.to_s)
end
- def shallow_scope(path, options = {}) #:nodoc:
+ def shallow_scope #:nodoc:
scope = { :as => @scope[:shallow_prefix],
:path => @scope[:shallow_path] }
@scope = @scope.new scope
- scope(path, options) { yield }
+ yield
ensure
@scope = @scope.parent
end