Module: Spree::AdjustmentSource
- Included in:
- Promotion::Actions::CreateAdjustment, Promotion::Actions::CreateItemAdjustments, TaxRate
- Defined in:
- app/models/concerns/spree/adjustment_source.rb
Instance Method Summary collapse
- #deals_with_adjustments_for_deleted_source ⇒ Object
- #remove_adjustments_from_incomplete_orders ⇒ Object
Instance Method Details
#deals_with_adjustments_for_deleted_source ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/concerns/spree/adjustment_source.rb', line 5 def deals_with_adjustments_for_deleted_source Spree::Deprecation.warn "AdjustmentSource#deals_with_adjustments_for_deleted_source is deprecated. Please use AdjustmentSource#remove_adjustments_from_incomplete_orders instead." remove_adjustments_from_incomplete_orders # The following is deprecated. As source_type without a source_id isn't # much better than a source_id that doesn't exist. In Solidus itself the # relevant classes use `acts_as_paranoid` so it is useful to keep the # source_id around. adjustments. joins(:order). merge(Spree::Order.complete). update_all(source_id: nil, updated_at: Time.current) end |
#remove_adjustments_from_incomplete_orders ⇒ Object
20 21 22 23 24 25 |
# File 'app/models/concerns/spree/adjustment_source.rb', line 20 def remove_adjustments_from_incomplete_orders adjustments. joins(:order). merge(Spree::Order.incomplete). destroy_all end |