mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Fix specs
This commit is contained in:
@@ -72,8 +72,25 @@ module Spree
|
||||
render json: @variants, each_serializer: ::Api::Admin::VariantSerializer
|
||||
end
|
||||
|
||||
def destroy
|
||||
@url_filters = ::ProductFilters.new.extract(request.query_parameters)
|
||||
|
||||
@variant = Spree::Variant.find(params[:id])
|
||||
flash[:success] = delete_variant
|
||||
|
||||
redirect_to spree.admin_product_variants_url(params[:product_id], @url_filters)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def delete_variant
|
||||
if VariantDeleter.new.delete(@variant)
|
||||
Spree.t('notice_messages.variant_deleted')
|
||||
else
|
||||
Spree.t('notice_messages.variant_not_deleted')
|
||||
end
|
||||
end
|
||||
|
||||
def create_before
|
||||
@object.save
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user