Module: SolidusLegacyPromotions::SpreeLineItemPatch

Defined in:
app/patches/models/solidus_legacy_promotions/spree_line_item_patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



5
6
7
8
# File 'app/patches/models/solidus_legacy_promotions/spree_line_item_patch.rb', line 5

def self.prepended(base)
  base.has_many :line_item_actions, dependent: :destroy
  base.has_many :actions, through: :line_item_actions
end

Instance Method Details

#total_before_taxObject



10
11
12
# File 'app/patches/models/solidus_legacy_promotions/spree_line_item_patch.rb', line 10

def total_before_tax
  amount + adjustments.select { |value| !value.tax? && value.eligible? }.sum(&:amount)
end