Sha256: d71f4981976b56896cc96a050dbc824065ef8773625247a387ff5e7757cf437a

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

# Each Spree::LineItem can have multiple subscription_line_items. This
# allows a cart to represent multiple subscriptions to the same item in
# the same order.
module Spree
  module LineItems
    module SubscriptionLineItemsAssociation
      def self.prepended(base)
        base.has_many(
          :subscription_line_items,
          class_name: 'SolidusSubscriptions::LineItem',
          foreign_key: :spree_line_item_id,
          inverse_of: :spree_line_item,
          dependent: :destroy
        )

        base.accepts_nested_attributes_for :subscription_line_items
      end
    end
  end
end

Spree::LineItem.prepend Spree::LineItems::SubscriptionLineItemsAssociation

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_subscriptions-alpha-0.0.4 app/decorators/spree/line_items/subscription_line_items_association.rb