mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Refactor #vouchers
Use "has_many" instead of a method
This commit is contained in:
committed by
Maikel Linke
parent
4b5d6d7eac
commit
87cc525d27
@@ -62,6 +62,9 @@ module Spree
|
||||
has_many :line_item_adjustments, through: :line_items, source: :adjustments
|
||||
has_many :shipment_adjustments, through: :shipments, source: :adjustments
|
||||
has_many :all_adjustments, class_name: 'Spree::Adjustment', dependent: :destroy
|
||||
has_many :vouchers, -> { where(originator_type: 'Voucher') },
|
||||
class_name: 'Spree::Adjustment',
|
||||
dependent: :destroy
|
||||
|
||||
belongs_to :order_cycle
|
||||
belongs_to :distributor, class_name: 'Enterprise'
|
||||
@@ -618,10 +621,6 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
def vouchers
|
||||
adjustments.where(originator_type: 'Voucher')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fee_handler
|
||||
|
||||
Reference in New Issue
Block a user