Closed gerardo-navarro closed 2 years ago
This issue seems similar to https://github.com/rikas/zoho_hub/issues/29
@rikas What to do think?
Yeah seems like the same thing, I've been struggling to get time to dedicate to this project, will try to review that ASAP and maybe merge.
After researching a little bit I don't see an easy way to fix this... I would rather keep using attribute translations where needed. The default fields in Zoho are capitalized, so it will work for the default ones.
If you have custom fields with a different standard I would say it's up to you to make sure they work.
When using ZohoHub::BaseRecord without attribute_translation, then updating a zoho record does not work because the attributes are camelcased by default. Here is an example.
Deal.find("123123131312"). custom_deal_module_field
<= This will work like charm, because initializing a base record does not expect a camelcase field by default, see https://github.com/rikas/zoho_hub/blob/master/lib/zoho_hub/base_record.rb#L173Deal.update("123451231213123", custom_deal_module_field: "some Value")
<= This will not work, because zoho_hub camelcases the field name toCustom_Deal_Module_Field
and the ZOHO API does not know how to handle this, see https://github.com/rikas/zoho_hub/blob/master/lib/zoho_hub/with_attributes.rb#L51Although it can be easily fixed by defining an attribute_translation, it seems to me like inconsistent behavior.
What do you think?