Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/replicate/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ def create_or_update_replicant(instance, attributes)
# write replicated attributes to the instance
attributes.each do |key, value|
next if key == primary_key and not replicate_id
instance.send :write_attribute, key, value
# Don't write the attribute with the same value as before to avoid
# triggering unique key constraints
unless instance.send(:read_attribute, key) == value
instance.send :write_attribute, key, value
end
end

# save the instance bypassing all callbacks and validations
Expand Down