Sha256: 851e12e56a2985c0e700262cef8a20b47f5a520e469c7f1638b505455501d3b0

Contents?: true

Size: 667 Bytes

Versions: 6

Compression:

Stored size: 667 Bytes

Contents

module Ecom
  module Core
    class MaintenanceServiceOrder < ApplicationRecord
      NEW = 'New'.freeze
      IN_PROGRESS = 'In Progress'.freeze
      COMPLETED = 'Completed'.freeze

      STATUSES = [NEW, IN_PROGRESS, COMPLETED].freeze

      belongs_to :equipment_item
      belongs_to :maintenance_type
      belongs_to :prepared_by, class_name: 'Ecom::Core::User'
      belongs_to :approved_by, class_name: 'Ecom::Core::User', optional: true

      validates :title, :status, presence: true
      validates :status, inclusion: STATUSES

      scope :approved, -> { where(approved: true) }
      scope :unapproved, -> { where(approved: false) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecom_core-1.3.14 app/models/ecom/core/maintenance_service_order.rb
ecom_core-1.3.13 app/models/ecom/core/maintenance_service_order.rb
ecom_core-1.3.12 app/models/ecom/core/maintenance_service_order.rb
ecom_core-1.3.11 app/models/ecom/core/maintenance_service_order.rb
ecom_core-1.3.10 app/models/ecom/core/maintenance_service_order.rb
ecom_core-1.3.9 app/models/ecom/core/maintenance_service_order.rb