mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Handle save method as it should be: return false if any errors occurs
This commit is contained in:
@@ -76,7 +76,7 @@ module Spree
|
||||
|
||||
product_set.collection.each { |p| authorize! :update, p }
|
||||
|
||||
if product_set.save && product_set.errors.empty?
|
||||
if product_set.save
|
||||
redirect_to main_app.bulk_products_api_v0_products_path(bulk_index_query)
|
||||
elsif product_set.errors.present?
|
||||
render json: { errors: product_set.errors }, status: :bad_request
|
||||
|
||||
@@ -97,6 +97,7 @@ module Sets
|
||||
variants_attributes.each do |attributes|
|
||||
create_or_update_variant(product, attributes)
|
||||
end
|
||||
product.errors.empty?
|
||||
end
|
||||
|
||||
def create_or_update_variant(product, variant_attributes)
|
||||
|
||||
Reference in New Issue
Block a user