mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Remove unnecessary writes on customer creation
The form only submits enterprise id and email address. We don't need to assign any other attributes.
This commit is contained in:
@@ -37,10 +37,9 @@ module Admin
|
||||
|
||||
def create
|
||||
@customer = Customer.find_or_new(customer_params[:email], customer_params[:enterprise_id])
|
||||
@customer.assign_attributes(customer_params)
|
||||
|
||||
if user_can_create_customer?
|
||||
@customer.set_created_manually_flag
|
||||
@customer.created_manually = true
|
||||
if @customer.save
|
||||
tag_rule_mapping = TagRule.mapping_for(Enterprise.where(id: @customer.enterprise))
|
||||
render_as_json @customer, tag_rule_mapping: tag_rule_mapping
|
||||
|
||||
Reference in New Issue
Block a user