处理导入题库标题中的换行字符
This commit is contained in:
parent
eb3644a197
commit
1f7bcbed20
|
@ -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
|
Loading…
Reference in New Issue