From 1f7bcbed20ef8f63fad191ab166fc8266d74b290 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 2 Feb 2016 21:28:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=AF=BC=E5=85=A5=E9=A2=98?= =?UTF-8?q?=E5=BA=93=E6=A0=87=E9=A2=98=E4=B8=AD=E7=9A=84=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/import_fix.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/tasks/import_fix.rake diff --git a/lib/tasks/import_fix.rake b/lib/tasks/import_fix.rake new file mode 100644 index 000000000..e5bd1a796 --- /dev/null +++ b/lib/tasks/import_fix.rake @@ -0,0 +1,14 @@ +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