diff --git a/app/models/conference.rb b/app/models/conference.rb index 6ec49ee..16bc384 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -10,6 +10,8 @@ class Conference < ActiveRecord::Base has_many :tracks has_many :halls + has_many :events, through: :tracks + accepts_nested_attributes_for :tracks, :halls, reject_if: :all_blank, allow_destroy: true diff --git a/app/models/track.rb b/app/models/track.rb index 7f5e7c2..3f4f010 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -1,5 +1,8 @@ class Track < ActiveRecord::Base + include PropositionAccepting + belongs_to :conference + has_many :events, through: :propositions, source: :proposable, source_type: Event validates :name, presence: true validates :color, presence: true, format: {with: /\A#?[a-f0-9]{6}\z/i}