namespace :import do desc "fix import name" task :fix => :environment do HomeworkCommon.find_each do |homework| name = homework.name.sub("\n", " ").sub("\r\n", " ") if name != homework.name homework.name = name homework.save! end end end end