Sha256: 00e0c988edbc3cde4ea81bddcbc2d407b936ebd79bc0d71acffcacb12b537ae1
Contents?: true
Size: 1.54 KB
Versions: 15
Compression:
Stored size: 1.54 KB
Contents
module Ecom module Core class Task < ApplicationRecord include AASM has_ancestry belongs_to :work_product belongs_to :task_template belongs_to :work_package, optional: true belongs_to :performer, class_name: 'Ecom::Core::User', optional: true belongs_to :approver, class_name: 'Ecom::Core::User', optional: true belongs_to :supervisor, class_name: 'Ecom::Core::User', optional: true belongs_to :quality_controller, class_name: 'Ecom::Core::User', optional: true validates :code, :name, :status, :percent_completed, presence: true validates_numericality_of :percent_completed, only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 100 scope :by_status, ->(status) { where(status: status) } aasm column: 'status' do state :new, initial: true state :in_progress state :submitted state :under_review state :completed event :start do transitions from: :new, to: :in_progress end event :submit do transitions from: :in_progress, to: :submitted end event :review do transitions from: :submitted, to: :under_review end event :complete do transitions from: %i[submitted under_review], to: :completed end event :rework do transitions from: :under_review, to: :in_progress end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems