added task users:fix_corrupted_country_codes

This commit is contained in:
Jonathan Kolyer 2014-06-30 12:26:46 +00:00
parent 631899007e
commit 932513a00b
1 changed files with 9 additions and 0 deletions

View File

@ -6,4 +6,13 @@ namespace :users do
User.deliver_new_musician_notifications(since_date)
end
desc "Fix corrupted country codes"
task :fix_corrupted_country_codes do |task, args|
User.where(["country like ?","{:country%"]).find_each do |uu|
if uu.country =~ /{:countrycode=>"([A-Z]+)",/
uu.update_attribute(:country,$1)
end
end
end
end