Sha256: ee891fddf591f5806236e7fc18f86828f2a6331058afd85e32cb7d4f3d9729b1
Contents?: true
Size: 737 Bytes
Versions: 10
Compression:
Stored size: 737 Bytes
Contents
module Ecom module Core class CrewTime < ApplicationRecord belongs_to :attendance_sheet_entry belongs_to :overtime_type, optional: true validates :hours, :converted_hours, presence: true # validates_each :date do |record, attr, value| # if record.crew && value && (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
10 entries across 10 versions & 1 rubygems