Sha256: 2ac143b4191618c13c296e8e7a717e53f77110695c98335096929040ed6f5b9c

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true

module SolidusSubscriptions
  module Spree
    module Variant
      module AutoDeleteFromSubscriptions
        def self.prepended(base)
          base.after_discard(:remove_from_subscriptions)
          base.after_destroy(:remove_from_subscriptions)
        end

        def remove_from_subscriptions
          SolidusSubscriptions::LineItem.where(subscribable: self).delete_all
        end
      end
    end
  end
end

Spree::Variant.prepend(SolidusSubscriptions::Spree::Variant::AutoDeleteFromSubscriptions)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_subscriptions-1.0.0.rc1 app/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions.rb