diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-27 16:06:55 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-27 16:20:46 -0700 |
commit | 9e652b65c2c481f2b4ae0cda9df42d4bb56b9f3c (patch) | |
tree | b78807d0f76bf72f0db538ac2b31c6f7858c31fa | |
parent | 8aa86babad2eddb5244ba79b4e3b5702e7e77217 (diff) | |
download | rails-9e652b65c2c481f2b4ae0cda9df42d4bb56b9f3c.tar.gz rails-9e652b65c2c481f2b4ae0cda9df42d4bb56b9f3c.tar.bz2 rails-9e652b65c2c481f2b4ae0cda9df42d4bb56b9f3c.zip |
reduce method calls in the dynamic finder matcher
-rw-r--r-- | activerecord/lib/active_record/dynamic_finder_match.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/dynamic_finder_match.rb b/activerecord/lib/active_record/dynamic_finder_match.rb index 533bc331ae..e8f3f8b560 100644 --- a/activerecord/lib/active_record/dynamic_finder_match.rb +++ b/activerecord/lib/active_record/dynamic_finder_match.rb @@ -6,8 +6,8 @@ module ActiveRecord # class DynamicFinderMatch def self.match(method) - df_match = self.new(method) - df_match.finder ? df_match : nil + df_match = new(method) + df_match.finder && df_match end def initialize(method) @@ -35,11 +35,11 @@ module ActiveRecord attr_reader :finder, :attribute_names, :instantiator def finder? - !@finder.nil? && @instantiator.nil? + @finder && !@instantiator end def instantiator? - @finder == :first && !@instantiator.nil? + @finder == :first && @instantiator end def creator? |