Sha256: 14938208f79d90637cd8363fce3b46b89365fb96f9c98daf720bbe116d327266
Contents?: true
Size: 707 Bytes
Versions: 1
Compression:
Stored size: 707 Bytes
Contents
module Ecom module Core class CrewTime < ApplicationRecord belongs_to :crew belongs_to :overtime_type, optional: true validates :date, :hours, :converted_hours, presence: true validates_each :date do |record, attr, value| if record.crew && (value < record.crew.employment_date) record.errors.add(attr, 'should be after employment date') end end before_save :calculate_converted_hours def calculate_converted_hours if overtime rate = OvertimeType.find(overtime_type_id).rate self.converted_hours = hours * rate else self.converted_hours = hours end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ecom_core-1.0.18 | app/models/ecom/core/crew_time.rb |