clarion/db/migrate/20141013134153_create_events_to_speakers_join_table.rb

13 lines
318 B
Ruby
Raw Normal View History

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