diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 14:39:33 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 14:39:33 -0700 |
commit | d193b3bbf6459e7684bd531df49f877803aadd0a (patch) | |
tree | f651bb5d49d13c9594278916fc25efafdb0a65b5 | |
parent | ae3269b79b32ecbb141a37b4c8ccf6e330b1a631 (diff) | |
download | rails-d193b3bbf6459e7684bd531df49f877803aadd0a.tar.gz rails-d193b3bbf6459e7684bd531df49f877803aadd0a.tar.bz2 rails-d193b3bbf6459e7684bd531df49f877803aadd0a.zip |
let the `controller` method push / pop the stack
since `controller` and `controller_scope` were the same, just combine
them
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 16 |
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 |