aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 46d6f34c04..3f43bfdc56 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -823,9 +823,10 @@ module ActionDispatch
# match "bacon", action: :bacon, via: :get
# end
def controller(controller)
- controller_scope(controller) do
- yield
- end
+ @scope = @scope.new(controller: controller)
+ yield
+ ensure
+ @scope = @scope.parent
end
# Scopes routes to a specific namespace. For example:
@@ -1682,7 +1683,7 @@ module ActionDispatch
def resource_scope(resource) #:nodoc:
@scope = @scope.new(:scope_level_resource => resource)
- controller_scope(resource.resource_scope) { yield }
+ controller(resource.resource_scope) { yield }
ensure
@scope = @scope.parent
end
@@ -1792,13 +1793,6 @@ module ActionDispatch
end
private
- def controller_scope(controller)
- @scope = @scope.new(controller: controller)
- yield
- ensure
- @scope = @scope.parent
- end
-
def path_scope(path)
@scope = @scope.new(path: merge_path_scope(@scope[:path], path))
yield