Product error handling
This commit is contained in:
@@ -52,7 +52,7 @@ module Suppliers
|
||||
format.json { render json: @product, status: :created }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @product.errors, status: :unprocessable_entity }
|
||||
format.json { render json: {errors: @product.errors}, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -68,7 +68,7 @@ module Suppliers
|
||||
format.json { render json: @product }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @product.errors, status: :unprocessable_entity }
|
||||
format.json { render json: {errors: @product.errors}, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user