diff options
author | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-07-27 14:37:32 +0200 |
---|---|---|
committer | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-07-27 14:42:00 +0200 |
commit | 5b01d2a962f7bda1a33c3d88c2db36af6d1de072 (patch) | |
tree | a98b7fffcea81106f480c97ed38b4817038a7ded /lib/solidus_subscriptions/permitted_attributes.rb | |
parent | 186f09b03cbd79a6e74f1c6248bd320c8d6fd1e0 (diff) |
Update default permitted attributes
The billing address as well as the interval and end date can now be
set directly on the subscription, so we need to permit those attributes
by default.
Diffstat (limited to 'lib/solidus_subscriptions/permitted_attributes.rb')
-rw-r--r-- | lib/solidus_subscriptions/permitted_attributes.rb | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/solidus_subscriptions/permitted_attributes.rb b/lib/solidus_subscriptions/permitted_attributes.rb index c93b10b..d1ae5a1 100644 --- a/lib/solidus_subscriptions/permitted_attributes.rb +++ b/lib/solidus_subscriptions/permitted_attributes.rb @@ -4,33 +4,15 @@ module SolidusSubscriptions module PermittedAttributes class << self - def update_spree_permiteed_attributes - ::Spree::PermittedAttributes.line_item_attributes << { - subscription_line_items_attributes: nested( - subscription_line_item_attributes - ) - } - - ::Spree::PermittedAttributes.user_attributes << { - subscriptions_attributes: nested(subscription_attributes) - } - end - def subscription_line_item_attributes [Config.subscription_line_item_attributes] end def subscription_attributes Config.subscription_attributes | [ - { line_items_attributes: nested(subscription_line_item_attributes) - [:subscribable_id] } + line_items_attributes: (subscription_line_item_attributes | [:id] - [:subscribable_id]), ] end - - private - - def nested(attributes) - attributes | [:id] - end end end end |