Sha256: b7b0555e1d4e553372bbd14cf120d58e7474f0e9b2400202b3aafa4aca46f1d3
Contents?: true
Size: 683 Bytes
Versions: 1
Compression:
Stored size: 683 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| record.errors.add(attr, 'should be after employment date') if record.crew && value < record.crew.employment_date 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.17 | app/models/ecom/core/crew_time.rb |