Class: Spree::TaxRate
- Includes:
- AdjustmentSource, CalculatedAdjustments, SoftDeletable
- Defined in:
- app/models/spree/tax_rate.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #adjustment_label(amount) ⇒ Object
-
#compute_amount(item) ⇒ Object
This method is used by Adjustment#update to recalculate the cost.
Methods included from AdjustmentSource
#remove_adjustments_from_incomplete_orders
Methods included from CalculatedAdjustments
#calculator_type, #calculator_type=
Methods inherited from Base
Methods included from Core::Permalinks
#generate_permalink, #save_permalink
Instance Method Details
#active? ⇒ Boolean
95 96 97 98 |
# File 'app/models/spree/tax_rate.rb', line 95 def active? (starts_at.nil? || starts_at < Time.current) && (expires_at.nil? || expires_at > Time.current) end |
#adjustment_label(amount) ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'app/models/spree/tax_rate.rb', line 100 def adjustment_label(amount) I18n.t( translation_key(amount), scope: "spree.adjustment_labels.tax_rates", name: name.presence || tax_categories.map(&:name).join(", "), amount: amount_for_adjustment_label ) end |
#compute_amount(item) ⇒ Object
This method is used by Adjustment#update to recalculate the cost.
91 92 93 |
# File 'app/models/spree/tax_rate.rb', line 91 def compute_amount(item) calculator.compute(item) end |