TaskStatus::Transition model
This commit is contained in:
@@ -4,6 +4,10 @@ class TaskStatus < ApplicationRecord
|
||||
belongs_to :workflow
|
||||
has_one :project, through: :workflow
|
||||
|
||||
has_many :from_transitions, class_name: 'TaskStatus::Transition', inverse_of: :from, dependent: :destroy
|
||||
has_many :to_transitions, class_name: 'TaskStatus::Transition', inverse_of: :to, dependent: :destroy
|
||||
has_many :next_statuses, class_name: 'TaskStatus', through: :from_transitions, source: :to
|
||||
|
||||
enum :icon, %w[new achived done circle_dash hammer play tool].index_by(&:itself), default: 'new', scopes: false
|
||||
enum :color, %w[blue gray yellow green purple pink].index_by(&:itself), default: 'gray', scopes: false
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TaskStatus
|
||||
class Transition < ApplicationRecord
|
||||
self.table_name = 'task_status_transitions'
|
||||
|
||||
belongs_to :from, class_name: '::TaskStatus'
|
||||
belongs_to :to, class_name: '::TaskStatus'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user