mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-02 06:51:40 +00:00
Handle strong params in spree/admin/products_controller
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user