class UpdatePrincipalActivity < ActiveRecord::Migration def up User.all.each do |user| transaction do user.principal_acts << PrincipalActivity.new(:user_id => user.id,:principal_id => user.id) user.journals_for_messages.each do |jour| jour.principal_acts << PrincipalActivity.new(:user_id => jour.user_id,:principal_id => user.id) end end end end def down end end