Sha256: 2a67270e96bdf1aee8b0f55733108e93ed33f36a543cfe94ddbca303ef2a2618
Contents?: true
Size: 726 Bytes
Versions: 17
Compression:
Stored size: 726 Bytes
Contents
module Ecom module Core class WorkOrder < ApplicationRecord before_save :add_reference_number NEW = 'New'.freeze IN_PROGRESS = 'In Progress'.freeze COMPLETED = 'Completed'.freeze STATUSES = [NEW, IN_PROGRESS, COMPLETED].freeze validates :name, :assigned_to_id, :generated_by_id, :status, :start_date, :end_date, presence: true validates :status, presence: true, inclusion: STATUSES belongs_to :assigned_to, class_name: 'Ecom::Core::Crew' belongs_to :generated_by, class_name: 'Ecom::Core::User' has_many :tasks def add_reference_number self.reference_number = "WO-#{(Time.now.to_f * 1000).to_i}" end end end end
Version data entries
17 entries across 17 versions & 1 rubygems