Closed cbmarchetti closed 2 years ago
You must consider the situation when a user is being created (doesn't exist yet). So, this code would work:
unless new_record?
self.custom_field_values = { 147=> CustomValue.where(customized_id: @user.id, custom_field_id: 131).first }
self.save_custom_field_values
end
thanks for the support!
Hi, I need to save custom field values to users.
Any idea??
self.custom_field_values = { 147=> CustomValue.where(:customized_id => @user.id.to_s, :custom_field_id => '131').first.to_s} self.save_custom_field_values