Product error handling

This commit is contained in:
2014-11-27 14:48:33 +01:00
parent 60f014811c
commit 5453837880
20 changed files with 96 additions and 39 deletions
@@ -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