Sha256: bfdf6fa6572cd3c19a9a89867af85989446f52f77d5dd6aa2dbd72f46a6dba0d
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
## # As Source Standard 是源标准的领域逻辑关注点。 module Unidom::Standard::Concerns::AsSourceStandard extend ActiveSupport::Concern include Unidom::Common::Concerns::ArgumentValidation included do |includer| has_many :target_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :source_id has_many :target_standards, through: :target_associatings, source: :target def associate!(target, due_to: 'REVS', at: Time.now) assert_present! :target, target assert_present! :due_to, due_to assert_present! :at, at target_associatings.target_is(target).association_coded_as(due_to).valid_at(now: at).alive.first_or_create! opened_at: at end def associate?(target, due_to: 'REVS', at: Time.now) assert_present! :target, target assert_present! :due_to, due_to assert_present! :at, at target_associatings.target_is(target).association_coded_as(due_to).valid_at(now: at).alive.exists? end end module ClassMethods end end
Version data entries
3 entries across 3 versions & 1 rubygems