socialforge/db/migrate/20161008015936_add_syllabus...

14 lines
310 B
Ruby
Raw Normal View History

2016-10-08 10:21:33 +08:00
class AddSyllabusMembers < ActiveRecord::Migration
def up
Syllabus.all.each do |syllabus|
if syllabus.syllabus_members.empty?
member = SyllabusMember.create(:user_id => syllabus.user_id, :rank => 1)
syllabus.syllabus_members << member
end
end
end
def down
end
end