Skip to content

Commit

Permalink
Merge pull request #8826 from acapilleri/different_target
Browse files Browse the repository at this point in the history
Improved different_target conditions
  • Loading branch information
carlosantoniodasilva committed Jan 8, 2013
2 parents b28d6e2 + 3543fde commit d106925
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -50,8 +50,11 @@ def update_counters(record)

# Checks whether record is different to the current target, without loading it
def different_target?(record)
record.nil? && owner[reflection.foreign_key] ||
record && record.id != owner[reflection.foreign_key]
if record.nil?
owner[reflection.foreign_key]
else
record.id != owner[reflection.foreign_key]
end
end

def replace_keys(record)
Expand Down

0 comments on commit d106925

Please sign in to comment.