diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 13:36:17 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-10 13:36:17 -0700 |
commit | 6ac882bb58b429d20b76c96975df7dabaf618988 (patch) | |
tree | 4875a37effd54653c8df1b81d696e523463615a7 /actionpack | |
parent | 3c8775349c5ecbdbf98e1815b2d65d2955196564 (diff) | |
download | rails-6ac882bb58b429d20b76c96975df7dabaf618988.tar.gz rails-6ac882bb58b429d20b76c96975df7dabaf618988.tar.bz2 rails-6ac882bb58b429d20b76c96975df7dabaf618988.zip |
avoid is_a? calls
add a predicate method so that we can avoid is_a? calls on the resource
object.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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. |