Sha256: b715a54fde09c5c6f69e33f99bca0150e4aa0572444a12c9b0f638bd2acc3508

Contents?: true

Size: 482 Bytes

Versions: 1

Compression:

Stored size: 482 Bytes

Contents

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

      before_save :set_employment_date,
                  if: proc { |c| c.employment_date.nil? }

      belongs_to :crew_type

      validates :name, :qualification, presence: true
      validates :employment, inclusion: [PERMANENT, TEMPORARY]

      def set_employment_date
        self.employment_date = Date.today
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecom_core-1.2.6 app/models/ecom/core/crew.rb