Sha256: 5d2046102f09463540b7306520bbf2a0fe2534666e5a2683aa406a137ca43e56
Contents?: true
Size: 555 Bytes
Versions: 2
Compression:
Stored size: 555 Bytes
Contents
class Absence < ActiveRecord::Base validates_presence_of :user_id validates_presence_of :on validates_presence_of :reason validates_uniqueness_of :on, :scope => :user_id def validate if Work.exists? ['user_id = ? AND (started_on = ? OR (started_on <= ? AND completed_at IS NOT NULL AND completed_at >= ?))', user_id, on, on, on] errors.add :on, "You have already registered work on this date." end if PublicHoliday.exists? :on => on errors.add :on, "You cannot mark absence on a public holiday." end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
backlog-0.28.0 | app/models/absence.rb |
backlog-0.29.0 | app/models/absence.rb |