do param slice for supplier products params
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user