Sha256: 75b6d877adb172e26d2561f2027c27c578355ad4ae650390b12496c98804bd79

Contents?: true

Size: 446 Bytes

Versions: 8

Compression:

Stored size: 446 Bytes

Contents

module Ecom
  module Core
    class CrewContract < ApplicationRecord
      belongs_to :crew

      validates :contract_no, :from, :to, :place_of_work, :probation_period, :contract_type, presence: true
      validates :contract_no, uniqueness: true
      validate :validate_date_range

      def validate_date_range
        return unless from && to

        errors.add(:to, 'cannot be before from date.') if from >= to
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ecom_core-1.2.34 app/models/ecom/core/crew_contract.rb
ecom_core-1.2.33 app/models/ecom/core/crew_contract.rb
ecom_core-1.2.32 app/models/ecom/core/crew_contract.rb
ecom_core-1.2.31 app/models/ecom/core/crew_contract.rb
ecom_core-1.2.30 app/models/ecom/core/crew_contract.rb
ecom_core-1.2.29 app/models/ecom/core/crew_contract.rb
ecom_core-1.2.28 app/models/ecom/core/crew_contract.rb
ecom_core-1.2.27 app/models/ecom/core/crew_contract.rb