class DeleteAnonymousJour < ActiveRecord::Migration def up jour_count = Journal.all.count / 30 + 2 transaction do for i in 1 ... jour_count do i Journal.page(i).per(30).each do |jour| jour.destroy if jour.user_id == 2 end end end end def down end end