2021-02-10 23:48:18 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
|
|
|
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
|
|
|
module Model::TrxAssignable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
include Model::Houidable
|
|
|
|
include Model::Jbuilder
|
|
|
|
include Model::Eventable
|
|
|
|
|
|
|
|
add_builder_expansion :nonprofit, :supporter
|
|
|
|
|
|
|
|
add_builder_expansion :trx,
|
2021-04-07 21:43:58 +00:00
|
|
|
json_attribute: :transaction
|
2021-02-10 23:48:18 +00:00
|
|
|
|
|
|
|
has_one :transaction_assignment, as: :assignable
|
2021-04-07 21:43:58 +00:00
|
|
|
has_one :trx, through: :transaction_assignment, class_name: 'Transaction', foreign_key: 'transaction_id'
|
|
|
|
has_one :supporter, through: :transaction_assignment
|
|
|
|
has_one :nonprofit, through: :transaction_assignment
|
2021-02-10 23:48:18 +00:00
|
|
|
end
|
2021-04-07 21:43:58 +00:00
|
|
|
end
|