Sha256: 89414e895aa43989eeda1f8c200ac029c0992d56dd0e34c72fe77e7ea6d3f26c

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

module Unidom::Position::Concerns::AsSuperiorPost

  extend ActiveSupport::Concern

  included do |includer|

    has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :superior_post, foreign_key: :superior_post_id
    has_many :inferior_posts,                     through:    :inferior_post_reporting_structures,        source: :inferior_post

    def is_reported_to!(by: nil, at: Time.now, primary: false)
      inferior_post_reporting_structures.create! inferior_post: by, 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_superior_post.rb