Sha256: 929b61467dbe9fa34936be7dbde1571f66b4a7848a0364c0ca4ec84cdcb7e03b

Contents?: true

Size: 395 Bytes

Versions: 5

Compression:

Stored size: 395 Bytes

Contents

module Ecom
  module Model
    class Crew < ApplicationRecord
      PERMANENT = 'Permanent'.freeze
      TEMPORARY = 'Temporary'.freeze

      belongs_to :crew_type

      validates :name, :qualification, presence: true
      validates :wage, presence: true, if: ->(o) { o.employment == PERMANENT }
      validates :wage, absence: true, if: ->(o) { o.employment == TEMPORARY }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ecom_model-2.0.4 app/models/ecom/model/crew.rb
ecom_model-2.0.3 app/models/ecom/model/crew.rb
ecom_model-2.0.2 app/models/ecom/model/crew.rb
ecom_model-2.0.1 app/models/ecom/model/crew.rb
ecom_model-2.0.0 app/models/ecom/model/crew.rb