Sha256: 5f4de69bbe819141becba870dd91f2f6e71b79d8d1a70c08ba005e074ff5f949

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

module IntegrationPal
  class Job < ApplicationRecord
    PENDING_STATUS = 'pending'.freeze
    COMPLETED_STATUS = 'completed'.freeze
    IN_PROGRESS_STATUS = 'in_progress'.freeze
    FAILED_STATUS = 'failed'.freeze
    STATUSES = [PENDING_STATUS, COMPLETED_STATUS, IN_PROGRESS_STATUS, FAILED_STATUS].freeze

    store :job_params, coder: Hash

    belongs_to :worker

    validates :worker, presence: true
    validates :status, presence: true, inclusion: { in: STATUSES }

    before_validation :set_status
    def set_status
      self.status ||= PENDING_STATUS
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
integration_pal-0.1.1 app/models/integration_pal/job.rb
integration_pal-0.1.0 app/models/integration_pal/job.rb