Sha256: 23bd95e2d9538eb8704262e791230d434519c40b2ea40b9498708461ed374b5a
Contents?: true
Size: 955 Bytes
Versions: 1
Compression:
Stored size: 955 Bytes
Contents
## # Standard Association 是标准之间的关联关系。 # association_code: REVS 修订,RFRC 引用。 class Unidom::Standard::StandardAssociating < Unidom::Standard::ApplicationRecord self.table_name = 'unidom_standard_associatings' include Unidom::Common::Concerns::ModelExtension belongs_to :source, class_name: 'Unidom::Standard::Standard', foreign_key: :source_id belongs_to :target, class_name: 'Unidom::Standard::Standard', foreign_key: :target_id scope :source_is, ->(source) { where source_id: (source.respond_to?(:id) ? source.id : source) } scope :target_is, ->(target) { where target_id: (target.respond_to?(:id) ? target.id : target) } def self.associate!(source, with: target, due_to: 'REVS', at: Time.now) create! source_id: to_id(source), target_id: to_id(with), association_code: due_to, opened_at: at end end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Standard::StandardAssociating'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-standard-1.4.2 | app/models/unidom/standard/standard_associating.rb |