mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user