LegacyDonations should have multiple ModernDonations
This commit is contained in:
parent
7a9ccddbb9
commit
ad4ef1db9c
3 changed files with 3 additions and 3 deletions
|
@ -45,7 +45,7 @@ class Donation < ApplicationRecord
|
||||||
belongs_to :campaign
|
belongs_to :campaign
|
||||||
belongs_to :event
|
belongs_to :event
|
||||||
|
|
||||||
has_one :modern_donation, inverse_of: :legacy_donation
|
has_many :modern_donations, inverse_of: :legacy_donation
|
||||||
|
|
||||||
scope :anonymous, -> { where(anonymous: true) }
|
scope :anonymous, -> { where(anonymous: true) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class ModernDonation < ApplicationRecord
|
||||||
setup_houid :don
|
setup_houid :don
|
||||||
|
|
||||||
# TODO must associate with events and campaigns somehow
|
# TODO must associate with events and campaigns somehow
|
||||||
belongs_to :legacy_donation, class_name: 'Donation', foreign_key: :donation_id, inverse_of: :modern_donation
|
belongs_to :legacy_donation, class_name: 'Donation', foreign_key: :donation_id, inverse_of: :modern_donations
|
||||||
|
|
||||||
delegate :designation, :dedication, to: :legacy_donation
|
delegate :designation, :dedication, to: :legacy_donation
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ module UpdateDonation
|
||||||
donation.date = data[:date] if data[:date]
|
donation.date = data[:date] if data[:date]
|
||||||
end
|
end
|
||||||
|
|
||||||
modern_donation = donation.modern_donation
|
modern_donation = donation.modern_donations.first
|
||||||
trx = modern_donation.trx
|
trx = modern_donation.trx
|
||||||
# edits_to_payments
|
# edits_to_payments
|
||||||
if is_offsite
|
if is_offsite
|
||||||
|
|
Loading…
Reference in a new issue