109259406-name_convert

This commit is contained in:
Stas 2015-12-01 18:09:27 +02:00
parent e9895df211
commit 8bb49cdd42

View file

@ -4,12 +4,15 @@ namespace :convert do
start = Time.zone.now.to_f
puts "-----> Convert domain punycodes to unicode..."
count = 0
Domain.find_each(:batch_size => 1000) do |x|
count += 1
x.update_column(:name_puny, (SimpleIDN.to_unicode(x.name)))
old_name = x.name.strip.downcase
x.name = SimpleIDN.to_unicode(old_name)
x.name_puny = SimpleIDN.to_ascii(old_name)
x.save(validate: false)
end
puts "-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
end
end