Skip to content
Browse files

remove more nil checks

  • Loading branch information...
1 parent 1678e95 commit 93ee9f0cba607f1050610cddcfa509e5faa7e731 @tenderlove tenderlove committed Dec 12, 2013
Showing with 5 additions and 6 deletions.
  1. +5 −6 activerecord/lib/active_record/associations/belongs_to_association.rb
View
11 activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -8,17 +8,16 @@ def handle_dependency
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

0 comments on commit 93ee9f0

Please sign in to comment.
Something went wrong with that request. Please try again.