Class: Unidom::Party::PartyRelation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Unidom::Party::PartyRelation
- Includes:
- Common::Concerns::ModelExtension
- Defined in:
- app/models/unidom/party/party_relation.rb
Overview
Party Relation 是参与者关系。
Class Method Summary collapse
Class Method Details
.relate!(source_party: nil, target_party: nil, linkage_code: 'FRND', grade: 0, opened_at: Time.now, priority: 0, attributes: {}) ⇒ Object
18 19 20 21 22 23 |
# File 'app/models/unidom/party/party_relation.rb', line 18 def self.relate!(source_party: nil, target_party: nil, linkage_code: 'FRND', grade: 0, opened_at: Time.now, priority: 0, attributes: {}) relation = source_party_is(source_party).target_party_is(target_party).linkage_coded_as(linkage_code).first_or_initialize grade: grade, priority: priority, opened_at: opened_at relation.assign_attributes attributes relation.save! relation end |