Sha256: 503cf94f688a50e9cc9dfe5741bbf0c4376fb4327ace6fd4f289de389a686b23
Contents?: true
Size: 757 Bytes
Versions: 3
Compression:
Stored size: 757 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 :work_package 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ecom_core-1.3.14 | app/models/ecom/core/work_order.rb |
ecom_core-1.3.13 | app/models/ecom/core/work_order.rb |
ecom_core-1.3.12 | app/models/ecom/core/work_order.rb |