Handle strong params in spree/admin/products_controller

This commit is contained in:
Luis Ramos
2020-02-23 12:49:39 +00:00
parent eccaaca907
commit c110f4832d

View File

@@ -160,10 +160,16 @@ module Spree
private
def product_set_from_params(params)
collection_hash = Hash[params[:products].each_with_index.map { |p, i| [i, p] }]
collection_hash = Hash[products_params.each_with_index.map { |p, i| [i, p] }]
Spree::ProductSet.new(collection_attributes: collection_hash)
end
def products_params
params.require(:products).map do |product|
ActionController::Parameters.new(product.to_hash).permit(:id, :name)
end
end
def bulk_index_query(params)
params[:filters].to_h.merge(page: params[:page], per_page: params[:per_page])
end