From 932513a00b2e7f3c6413533c11daaa1f211400d1 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Mon, 30 Jun 2014 12:26:46 +0000 Subject: [PATCH] added task users:fix_corrupted_country_codes --- web/lib/tasks/users.rake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/lib/tasks/users.rake b/web/lib/tasks/users.rake index 7390f1334..b84af130e 100644 --- a/web/lib/tasks/users.rake +++ b/web/lib/tasks/users.rake @@ -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