aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-12-12 11:31:11 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2013-12-12 11:31:11 -0800
commit93ee9f0cba607f1050610cddcfa509e5faa7e731 (patch)
tree0f6c17e7474327780c9863e741fb8c25be6b012c /activerecord
parent1678e959e973de32287b65c52ebc6cce87148951 (diff)
downloadrails-93ee9f0cba607f1050610cddcfa509e5faa7e731.tar.gz
rails-93ee9f0cba607f1050610cddcfa509e5faa7e731.tar.bz2
rails-93ee9f0cba607f1050610cddcfa509e5faa7e731.zip
remove more nil checks
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/belongs_to_association.rb11
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