提交 6ac882bb 编写于 作者: A Aaron Patterson

avoid is_a? calls

add a predicate method so that we can avoid is_a? calls on the resource
object.
上级 3c877534
......@@ -1132,6 +1132,8 @@ def nested_scope
def shallow?
@shallow
end
def singleton?; false; end
end
class SingletonResource < Resource #:nodoc:
......@@ -1163,6 +1165,8 @@ def singular
alias :member_scope :path
alias :nested_scope :path
def singleton?; true; end
end
def resources_path_names(options)
......@@ -1479,7 +1483,7 @@ def shallow
end
def shallow?
parent_resource.instance_of?(Resource) && @scope[:shallow]
!parent_resource.singleton? && @scope[:shallow]
end
# Matches a url pattern to one or more routes.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册