diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-14 14:45:46 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-14 14:45:46 -0800 |
commit | c326969745c38aaca552aebf240af644440afab3 (patch) | |
tree | f21740698e7750a27d9f2e6797ff65f032e4ecf8 /activerecord | |
parent | dc11a77ab7730ec213b5042e1261a7be8c211396 (diff) | |
download | rails-c326969745c38aaca552aebf240af644440afab3.tar.gz rails-c326969745c38aaca552aebf240af644440afab3.tar.bz2 rails-c326969745c38aaca552aebf240af644440afab3.zip |
reduce funcalls by using falsey objects
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/belongs_to_association.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 391471849c..b5545f4084 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -12,7 +12,7 @@ module ActiveRecord def replace(record) record = record.target if AssociationProxy === record - raise_on_type_mismatch(record) unless record.nil? + raise_on_type_mismatch(record) if record update_counters(record) replace_keys(record) @@ -59,7 +59,7 @@ module ActiveRecord end def foreign_key_present? - !@owner[@reflection.foreign_key].nil? + @owner[@reflection.foreign_key] end # NOTE - for now, we're only supporting inverse setting from belongs_to back onto |