diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-12-12 11:31:11 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-12-12 11:31:11 -0800 |
commit | 93ee9f0cba607f1050610cddcfa509e5faa7e731 (patch) | |
tree | 0f6c17e7474327780c9863e741fb8c25be6b012c /activerecord/lib | |
parent | 1678e959e973de32287b65c52ebc6cce87148951 (diff) | |
download | rails-93ee9f0cba607f1050610cddcfa509e5faa7e731.tar.gz rails-93ee9f0cba607f1050610cddcfa509e5faa7e731.tar.bz2 rails-93ee9f0cba607f1050610cddcfa509e5faa7e731.zip |
remove more nil checks
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/belongs_to_association.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 7d96f0c372..7dc817fc66 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -8,17 +8,16 @@ module ActiveRecord end def replace(record) - raise_on_type_mismatch!(record) if record - - update_counters(record) if record + raise_on_type_mismatch!(record) + update_counters(record) replace_keys(record) + set_inverse_instance(record) + @updated = true else + update_counters(record) remove_keys end - set_inverse_instance(record) if record - - @updated = true if record self.target = record end |