socialforge/db/migrate/20150112024820_add_data_for...

11 lines
418 B
Ruby
Raw Normal View History

class AddDataForMembers < ActiveRecord::Migration
def change
StudentsForCourse.all.each do |stu|
if Member.where(:user_id => stu.student_id, :course_id => stu.course_id).first.nil?
mem = Member.new(:user_id => stu.student_id, :course_id => stu.course_id, :course_group_id => 0, :project_id => -1, :mail_notification => 0, :role_ids => [10])
mem.save!
end
end
end
end