Sha256: 297f4a78d2db16518e01aa8c2b38a61e225dd3eb705d6eb3fbb6a1901a0cf6b6

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

module Unidom::Party::Concerns::AsSourceParty

  extend ActiveSupport::Concern

  included do |includer|

    has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party

    def relate!(to: nil, due_to: nil, at: Time.now)
      target_party_relations.create! target_party: to, linkage_code: due_to, opened_at: at
    end

    #def relate?(to: nil, due_to: nil, at: Time.now)
    #  target_party_relations.target_party_is(to).linkage_coded_as(due_to).valid_at(now: at).alive.exists?
    #end

  end

  module ClassMethods
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-party-1.2 app/models/unidom/party/concerns/as_source_party.rb