From d193b3bbf6459e7684bd531df49f877803aadd0a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 10 Aug 2015 14:39:33 -0700 Subject: let the `controller` method push / pop the stack since `controller` and `controller_scope` were the same, just combine them --- actionpack/lib/action_dispatch/routing/mapper.rb | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'actionpack') 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 -- cgit v1.2.3