Sha256: 1320c3f2caa00593bcf8414c59da1950b3bd37e09ad4c1aef29915e2566f7c07
Contents?: true
Size: 870 Bytes
Versions: 1
Compression:
Stored size: 870 Bytes
Contents
# Standard Association 是标准之间的关联关系。 # association_code: REVS 修订,RFRC 引用。 class Unidom::Standard::StandardAssociating < ActiveRecord::Base self.table_name = 'unidom_standard_associatings' include Unidom::Common::Concerns::ModelExtension 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) } belongs_to :source, class_name: 'Unidom::Standard::Standard', foreign_key: :source_id belongs_to :target, class_name: 'Unidom::Standard::Standard', foreign_key: :target_id def self.associate!(source, target, association_code = 'REVS', opened_at: Time.now) create! source_id: to_id(source), target_id: to_id(target), association_code: association_code, opened_at: opened_at end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-standard-0.3 | app/models/unidom/standard/standard_associating.rb |