class DeleteValidProject < ActiveRecord::Migration def up projects = Project.where("project_type =?", 1) begin projects.each do |p| p.delete end rescue => e logger.error "Delete project failed ====>#{e}" end end def down end end