Class: Unidom::Position::PostReportingStructure

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Common::Concerns::ModelExtension
Defined in:
app/models/unidom/position/post_reporting_structure.rb

Overview

Post Reporting Structure 是岗位汇报结构。

Class Method Summary collapse

Class Method Details

.report!(superior_post: nil, inferior_post: nil, elemental: true, opened_at: Time.now) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
23
24
# File 'app/models/unidom/position/post_reporting_structure.rb', line 20

def self.report!(superior_post: nil, inferior_post: nil, elemental: true, opened_at: Time.now)
  raise ArgumentError.new('The superior_post argument is required.') if superior_post.blank?
  raise ArgumentError.new('The inferior_post argument is required.') if inferior_post.blank?
  self.inferior_post_is(inferior_post).superior_post_is(superior_post).valid_at.alive.first_or_create! elemental: elemental, opened_at: opened_at
end