EventSchedule validations
event, schedule, room and start_time are mandatory in EventSchedule.
This commit is contained in:
parent
354e15a76d
commit
0b26ed5c35
10 changed files with 26 additions and 15 deletions
|
|
@ -3,13 +3,16 @@ class EventSchedule < ActiveRecord::Base
|
|||
belongs_to :event
|
||||
belongs_to :room
|
||||
|
||||
validates :schedule, presence: true
|
||||
validates :event, presence: true
|
||||
validates :room, presence: true
|
||||
validates :start_time, presence: true
|
||||
|
||||
scope :confirmed, -> { joins(:event).where('state = ?', 'confirmed') }
|
||||
scope :canceled, -> { joins(:event).where('state = ?', 'canceled') }
|
||||
scope :withdrawn, -> { joins(:event).where('state = ?', 'withdrawn') }
|
||||
|
||||
def room_guid
|
||||
room.try(:guid)
|
||||
end
|
||||
delegate :guid, to: :room, prefix: true
|
||||
|
||||
##
|
||||
# Returns end of the event
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue