[Fix #1690] Strip html markup from procedure descriptions

This commit is contained in:
Frederic Merizen 2018-03-29 09:36:40 +02:00
parent 28cced9a95
commit 3f62bc3407

View file

@ -0,0 +1,17 @@
require Rails.root.join("app", "helpers", "html_to_string_helper")
namespace :'2018_03_29_procedure_description_markup' do
task strip: :environment do
include ActionView::Helpers::TextHelper
include HtmlToStringHelper
total = Procedure.count
Procedure.find_each(batch_size: 100).with_index do |p, i|
if (i % 100) == 0
print "Procedure #{i}/#{total}\n"
end
p.update_column(:description, html_to_string(p.description))
end
end
end