Sha256: df6031ba7738fc4dd0f81ee2d4c8c0ca371b039cbb4cb6d5911c8d89a4f3f5fd

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

module Unidom::Position::Concerns::AsInferiorPost

  extend ActiveSupport::Concern

  included do |includer|

    has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :inferior_post, foreign_key: :inferior_post_id
    has_many :superior_posts,                     through:    :superior_post_reporting_structures,        source: :superior_post

    def report_to!(superior_post, at: Time.now, primary: false)
      superior_post_reporting_structures.create! superior_post: superior_post, elemental: primary, opened_at: at
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-position-1.3 app/models/unidom/position/concerns/as_inferior_post.rb