2021-05-25 17:28:35 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Links an object bought and a payment schedule used to pay this object
|
|
|
|
class PaymentScheduleObject < Footprintable
|
|
|
|
belongs_to :object, polymorphic: true
|
2023-02-24 17:26:55 +01:00
|
|
|
belongs_to :reservation, foreign_key: 'object_id', inverse_of: :payment_schedule_object
|
|
|
|
belongs_to :subscription, foreign_key: 'object_id', inverse_of: :payment_schedule_object
|
|
|
|
belongs_to :statistic_profile_prepaid_pack, foreign_key: 'object_id', inverse_of: :payment_schedule_object
|
2021-05-25 17:28:35 +02:00
|
|
|
belongs_to :payment_schedule
|
2023-03-23 17:39:06 +01:00
|
|
|
has_one :chained_element, as: :element, dependent: :restrict_with_exception
|
2021-05-25 17:28:35 +02:00
|
|
|
|
|
|
|
after_create :chain_record
|
|
|
|
end
|