Introduce Booths and Call for Booths to OSEM

This commit is contained in:
nasia 2017-05-17 13:31:27 +03:00
parent 4d895ae3bc
commit 3172cfcbb2
22 changed files with 443 additions and 1 deletions

View file

@ -0,0 +1,22 @@
class CallForBooth < ActiveRecord::Base
belongs_to :conference
validates :start_date, :end_date, :booth_limit, presence: true
validate :before_end_of_conference
validate :start_date_before_end_date
private
def before_end_of_conference
errors
.add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
errors
.add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
end
def start_date_before_end_date
errors
.add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
end
end