mirror of
https://github.com/internetee/registry.git
synced 2025-05-21 03:39:40 +02:00
Story#114871365 - add rake task to update contacts country code
This commit is contained in:
parent
65f6b4b43e
commit
d18fb5e6be
1 changed files with 16 additions and 0 deletions
|
@ -32,5 +32,21 @@ namespace :convert do
|
|||
d.save!
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
desc 'Contact Address Country Code Upcase'
|
||||
task country_code_ucase: :environment do
|
||||
count = 0
|
||||
Contact.find_each do |c|
|
||||
if c.country_code.present? && c.country_code != c.country_code.upcase
|
||||
c.country_code = c.country_code.upcase
|
||||
c.update_columns(country_code: c.country_code.upcase)
|
||||
# c.send(:record_update)
|
||||
|
||||
count +=1
|
||||
puts "#{count} contacts has been changed" if count % 1000 == 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue