Introduce an association to Events from Conferences
This commit is contained in:
parent
050db7d124
commit
c9b6f03c32
|
@ -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
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue