diff --git a/app/controllers/admin/variant_overrides_controller.rb b/app/controllers/admin/variant_overrides_controller.rb index 41c95a4451..adeb8747e5 100644 --- a/app/controllers/admin/variant_overrides_controller.rb +++ b/app/controllers/admin/variant_overrides_controller.rb @@ -68,7 +68,7 @@ module Admin end def load_collection - collection_hash = Hash[params[:variant_overrides].each_with_index.map { |vo, i| [i, vo] }] + collection_hash = Hash[variant_overrides_params.each_with_index.map { |vo, i| [i, vo] }] @vo_set = VariantOverrideSet.new @variant_overrides, collection_attributes: collection_hash end @@ -92,5 +92,11 @@ module Admin full_messages.each { |fm| errors.add(:base, fm) } errors end + + def variant_overrides_params + params.require(:variant_overrides).map do |variant_override| + variant_override.permit(:id, :price, :count_on_hand, :sku, :on_demand) + end + end end end diff --git a/app/controllers/spree/admin/products_controller.rb b/app/controllers/spree/admin/products_controller.rb index ae085d2b11..5bd268ab27 100644 --- a/app/controllers/spree/admin/products_controller.rb +++ b/app/controllers/spree/admin/products_controller.rb @@ -166,7 +166,7 @@ module Spree def products_params params.require(:products).map do |product| - ActionController::Parameters.new(product.to_hash).permit(:id, :name) + product.permit(:id, :name) end end