Class: HrLite::ApprovalFlow
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- HrLite::ApprovalFlow
- Includes:
- Audited
- Defined in:
- app/models/hr_lite/approval_flow.rb
Overview
"Leave needs the manager, then HR." One active flow per subject type; a type with no flow keeps whatever single-decision behaviour it had.
Constant Summary
Constants included from Audited
HrLite::Audited::REDACTED, HrLite::Audited::SKIPPED_ATTRIBUTES
Class Method Summary collapse
-
.approvable_types ⇒ Object
Subject types that have opted in.
- .for(subject_type) ⇒ Object
Instance Method Summary collapse
Class Method Details
.approvable_types ⇒ Object
Subject types that have opted in. Declared rather than derived so a flow cannot be pointed at a model that has no idea it is approvable.
22 23 24 25 26 27 |
# File 'app/models/hr_lite/approval_flow.rb', line 22 def self.approvable_types %w[ HrLite::LeaveRequest HrLite::CompOffRequest HrLite::RegularizationRequest HrLite::Resignation HrLite::Expense ].freeze end |
.for(subject_type) ⇒ Object
16 17 18 |
# File 'app/models/hr_lite/approval_flow.rb', line 16 def self.for(subject_type) active.find_by(subject_type: subject_type.to_s) end |
Instance Method Details
#subject_label ⇒ Object
29 |
# File 'app/models/hr_lite/approval_flow.rb', line 29 def subject_label = subject_type.demodulize.underscore.humanize |