blob: 73bbc2533fc92237cc964a74b1fd2f405a280053 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# 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
::Spree::Variant.prepend self
end
end
end
end
|