do param slice for supplier products params

This commit is contained in:
2020-03-01 18:05:21 -05:00
parent 73c207c324
commit 2a5f7e6b03
@@ -94,7 +94,13 @@ module Suppliers
private private
def product_params def product_params
params.require(:product).permit(:name, :code, :price, :description, :image, :visible, :position, :active, :product_category_id) permitted_attributes = [:name, :code, :price, :description, :image, :visible, :position, :active, :product_category_id]
# do not raise in development and test for json communication
if request.format.json?
params.require(:product).slice(*permitted_attributes).permit!
else
params.require(:product).permit permitted_attributes
end
end end
end end
end end