Closed madleech closed 9 years ago
hmmm, this does look the same as #46. There must have been a regression at some point. I can see in the requests there that no ID is being sent with any of the contact details so the capsule api thinks they are new every time.
Looking into this now @madleech. At the moment when a record is created or updated none of the attributes are refreshed, which means that the various types of contact details don't get assigned an ID. You can workaround this bug at the moment by completely reloading the record:
org = CapsuleCRM::Organization.new(name: "Test org")
org.phones << CapsuleCRM::Phone.new(phone_number: 1234, type: 'Work')
org.save
org = CapsuleCRM::Organization.find(org.id)
org.phones << CapsuleCRM::Phone.new(phone_number: 5678, type: 'Home')
org.save
I'll try to get a fix in place today though.
Ok, you can at least use #reload
now if you upgrade to ~> 1.10.1. The other fix is a bit trickier mainly due to some pretty terrible design decisions I made early in the development of this gem.
Great, #reload
makes things a lot cleaner. Thanks heaps.
If I create a new organization and save it multiple times, the contact details get duplicated. Looks the same as #46?
Example code:
Log output:
Each PUT is the same, but each response includes duplicate contact details.