whitelist table and section params on json call

This commit is contained in:
2013-12-22 16:04:42 +01:00
parent 69132b0c07
commit 592aa65054
2 changed files with 14 additions and 2 deletions
@@ -162,7 +162,13 @@ module Suppliers
private
def section_params
params.require(:section).permit(:title, :path, :width, :height)
permitted_attributes = [:title, :path, :width, :height]
# do not raise in development and test for json communication
if request.format.json?
params.require(:section).slice(*permitted_attributes).permit!
else
params.require(:section).permit permitted_attributes
end
end
end
end
@@ -96,7 +96,13 @@ module Suppliers
private
def table_params
params.require(:table).permit(:number, :section_id, :position_x, :position_y)
permitted_attributes = [:number, :section_id, :position_x, :position_y]
# do not raise in development and test for json communication
if request.format.json?
params.require(:table).slice(*permitted_attributes).permit!
else
params.require(:table).permit permitted_attributes
end
end
end
end