From 6ac882bb58b429d20b76c96975df7dabaf618988 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 10 Aug 2015 13:36:17 -0700 Subject: avoid is_a? calls add a predicate method so that we can avoid is_a? calls on the resource object. --- actionpack/lib/action_dispatch/routing/mapper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 11117dbc20..09abeb43a1 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1132,6 +1132,8 @@ module ActionDispatch def shallow? @shallow end + + def singleton?; false; end end class SingletonResource < Resource #:nodoc: @@ -1163,6 +1165,8 @@ module ActionDispatch alias :member_scope :path alias :nested_scope :path + + def singleton?; true; end end def resources_path_names(options) @@ -1479,7 +1483,7 @@ module ActionDispatch 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. -- cgit v1.2.3