Module: SolidusSubscriptions::Spree::Variant::AutoDeleteFromSubscriptions

Defined in:
app/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



7
8
9
10
# File 'app/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions.rb', line 7

def self.prepended(base)
  base.after_discard(:remove_from_subscriptions)
  base.after_destroy(:remove_from_subscriptions)
end

Instance Method Details

#remove_from_subscriptionsObject



12
13
14
# File 'app/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions.rb', line 12

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