Skip to content

Commit

Permalink
improved different_target conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
acapilleri committed Jan 8, 2013
1 parent e5d4367 commit 3543fde
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 # Checks whether record is different to the current target, without loading it
def different_target?(record) def different_target?(record)
record.nil? && owner[reflection.foreign_key] || if record.nil?
record && record.id != owner[reflection.foreign_key] owner[reflection.foreign_key]
else
record.id != owner[reflection.foreign_key]
end
end end


def replace_keys(record) def replace_keys(record)
Expand Down

0 comments on commit 3543fde

Please sign in to comment.