mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
Include Calculator attributes in PaymentMethod nested attributes and DRY repeated code
This commit is contained in:
@@ -86,12 +86,7 @@ module Spree
|
||||
params.require(:shipping_method).permit(
|
||||
:name, :description, :display_on, :require_ship_address, :tag_list, :calculator_type,
|
||||
distributor_ids: [],
|
||||
calculator_attributes: [
|
||||
:id, :preferred_currency, :preferred_amount, :preferred_unit_from_list,
|
||||
:preferred_per_unit, :preferred_flat_percent, :preferred_first_item,
|
||||
:preferred_additional_item, :preferred_max_items, :preferred_minimal_amount,
|
||||
:preferred_normal_amount, :preferred_discount_amount
|
||||
]
|
||||
calculator_attributes: PermittedAttributes::Calculator.attributes
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ module PermittedAttributes
|
||||
:calculator_type, :preferred_api_key,
|
||||
:preferred_signature, :preferred_solution, :preferred_landing_page, :preferred_logourl,
|
||||
:preferred_test_mode, :calculator_type, { distributor_ids: [] },
|
||||
{ calculator_attributes: [:id, :preferred_currency, :preferred_amount] }]
|
||||
{ calculator_attributes: PermittedAttributes::Calculator.attributes }]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user