clarion/app/models/event.rb
Petko Bordjukov ab1ce49c29 UX tweaks
2014-09-07 00:06:50 +03:00

21 lines
602 B
Ruby

class Event < ActiveRecord::Base
validates :title, presence: true
validates :length, presence: true, numericality: {only_integer: true, greater_than: 0}
validates :abstract, presence: true
validates :description, presence: true
validates :track_id, inclusion: { in: (Conference.current.try(:tracks) || []).map(&:id) }
validates :agreement, acceptance: true
belongs_to :track
has_one :conference, through: :track
belongs_to :user
after_create :send_new_event_notification
private
def send_new_event_notification
EventMailer.new_event_notification(self).deliver
end
end