Sha256: 3bbcb84d44103b6b7723e09e742c17b89b2d9d120b2c660a51a1bd82fbef940d

Contents?: true

Size: 815 Bytes

Versions: 10

Compression:

Stored size: 815 Bytes

Contents

##
# As Target Standard 是目标标准的领域逻辑关注点。

module Unidom::Standard::Concerns::AsTargetStandard

  extend ActiveSupport::Concern

  included do |includer|

    has_many :source_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :target_id
    has_many :source_standards,    through:    :source_associatings,                    source:      :source

    def is_associated!(source, due_to: 'REVS', at: Time.now)
      source_associatings.source_is(source).association_coded_as(due_to).valid_at(now: at).alive.first_or_create! opened_at: at
    end

    def is_associated?(source, due_to: 'REVS', at: Time.now)
      source_associatings.source_is(source).association_coded_as(due_to).valid_at(now: at).alive.exists?
    end

  end

  module ClassMethods
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
unidom-standard-1.4.7 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.4.6 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.4.5 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.4.4 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.4.3 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.4.2 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.4.1 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.4 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.3.6 app/models/unidom/standard/concerns/as_target_standard.rb
unidom-standard-1.3.5 app/models/unidom/standard/concerns/as_target_standard.rb