Add associations to Track and Conference to Event

This commit is contained in:
Petko Bordjukov 2015-07-19 14:32:25 +03:00
parent 0ece79a8ae
commit d381b800c4
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,9 @@
class Event < ActiveRecord::Base class Event < ActiveRecord::Base
include Proposable include Proposable
has_one :track, through: :proposition, source: :proposition_accepting, source_type: Track
has_one :conference, through: :track
validates :title, presence: true validates :title, presence: true
validates :length, presence: true, numericality: {only_integer: true, greater_than: 0} validates :length, presence: true, numericality: {only_integer: true, greater_than: 0}
validates :abstract, presence: true validates :abstract, presence: true