chore: Map country column during CSV import

This commit is contained in:
iamsivin
2026-05-08 12:37:10 +05:30
parent 53b2a517d7
commit cbc32f38d3
3 changed files with 60 additions and 28 deletions
+8 -2
View File
@@ -61,8 +61,14 @@ class DataImport::ContactManager
def update_contact_attributes(params, contact)
contact.name = params[:name] if params[:name].present?
contact.additional_attributes ||= {}
contact.additional_attributes[:company_name] = params[:company_name] if params[:company_name].present?
contact.additional_attributes[:city] = params[:city] if params[:city].present?
assign_additional_attributes(params, contact)
contact.country_code = params[:country] if params[:country].present?
contact.assign_attributes(custom_attributes: contact.custom_attributes.merge(params.except(:identifier, :email, :name, :phone_number)))
end
def assign_additional_attributes(params, contact)
contact.additional_attributes[:company_name] = params[:company_name] if params[:company_name].present?
contact.additional_attributes[:city] = params[:city] if params[:city].present?
contact.additional_attributes[:country] = params[:country] if params[:country].present?
end
end