Merge pull request #5038 from luisramos0/strong_params_prod

[Spree 2.1] Implement strong params in products, variants, variant_overrides and resource controllers
This commit is contained in:
Matt-Yorkley
2020-03-25 18:35:58 +01:00
committed by GitHub
6 changed files with 73 additions and 4 deletions

View File

@@ -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,15 @@ 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, :variant_id, :hub_id,
:price, :count_on_hand, :sku, :on_demand,
:default_stock, :resettable, :tag_list
)
end
end
end
end