mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Do not display double error when using js
This commit is contained in:
@@ -28,11 +28,14 @@ module Admin
|
||||
product_distribution = ProductDistribution.where(:enterprise_fee_id => @object).first
|
||||
if product_distribution
|
||||
p = product_distribution.product
|
||||
flash[:error] = "That enterprise fee cannot be deleted as it is referenced by a product distribution: #{p.id} - #{p.name}."
|
||||
error = "That enterprise fee cannot be deleted as it is referenced by a product distribution: #{p.id} - #{p.name}."
|
||||
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to collection_url }
|
||||
format.js { render text: flash[:error], status: 403 }
|
||||
format.html do
|
||||
flash[:error] = error
|
||||
redirect_to collection_url
|
||||
end
|
||||
format.js { render text: error, status: 403 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user