Permalink
Browse files

Changed the way account contacts are merged.

  • Loading branch information...
1 parent 24d47ab commit 54c9f81932d06cd2708eeb6c058818f82bedc289 @steveyken steveyken committed Mar 1, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/ffcrm_merge/accounts.rb
@@ -43,7 +43,9 @@ def merge_with(master, ignored_attr = [])
self.contacts.each do |contact|
# Check if contact belongs to master already? Can happen in CRM's where contacts can belong to multiple accounts
if AccountContact.where(:contact_id => contact.id).where(:account_id => master.id).size == 0
- AccountContact.create(:contact_id => contact.id, :account_id => master.id)
+ ac = AccountContact.where(:contact_id => contact.id).where(:account_id => self.id).first
+ ac.account_id = master.id
+ ac.save!
end
end

0 comments on commit 54c9f81

Please sign in to comment.