LegacyDonations should have multiple ModernDonations

This commit is contained in:
Eric Schultz 2021-05-10 14:18:42 -05:00 committed by Eric Schultz
parent 7a9ccddbb9
commit ad4ef1db9c
3 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@ class Donation < ApplicationRecord
belongs_to :campaign
belongs_to :event
has_one :modern_donation, inverse_of: :legacy_donation
has_many :modern_donations, inverse_of: :legacy_donation
scope :anonymous, -> { where(anonymous: true) }
end

View file

@ -7,7 +7,7 @@ class ModernDonation < ApplicationRecord
setup_houid :don
# 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

View file

@ -86,7 +86,7 @@ module UpdateDonation
donation.date = data[:date] if data[:date]
end
modern_donation = donation.modern_donation
modern_donation = donation.modern_donations.first
trx = modern_donation.trx
# edits_to_payments
if is_offsite