Allow an event to have more than one speaker
This commit is contained in:
parent
7fb71d8cf9
commit
649c5a768c
|
@ -10,6 +10,7 @@ class Event < ActiveRecord::Base
|
|||
has_one :conference, through: :track
|
||||
belongs_to :user # XXX: Transition to candidate_speaker
|
||||
belongs_to :candidate_speaker, class_name: 'User', foreign_key: 'user_id'
|
||||
has_and_belongs_to_many :speakers, class_name: 'SpeakerProfile'
|
||||
|
||||
after_create :send_new_event_notification
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
class CreateEventsToSpeakersJoinTable < ActiveRecord::Migration
|
||||
def up
|
||||
create_join_table :events, :speaker_profiles
|
||||
Event.all.each do |event|
|
||||
event.speakers << event.user.speaker_profile if event.user.speaker_profile.present?
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :events_speaker_profiles
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue