提交 d193b3bb 编写于 作者: A Aaron Patterson

let the `controller` method push / pop the stack

since `controller` and `controller_scope` were the same, just combine
them
上级 ae3269b7
......@@ -823,9 +823,10 @@ def scope(*args)
# 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 @@ def with_scope_level(kind)
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 @@ def api_only?
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册