From 1e8f10f1af71dc16b57b35178256ad257c16b614 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 16 Sep 2010 16:12:45 -0700 Subject: [PATCH] MS rake task to fix broken local people.... let me test it first on a server, but then you can run rake db:fix_diaspora_handle --- lib/tasks/db.rake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index e1c0aac31..56eddb266 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -22,6 +22,7 @@ namespace :db do require 'db/seeds/backer' create end + end desc 'Delete the collections in the current RAILS_ENV database' @@ -53,4 +54,19 @@ namespace :db do Rake::Task['db:seed:dev'].invoke puts "you did it!" end + + task :fix_diaspora_handle do + puts "fixing the people in this seed" + require 'config/environment' + + people = Person.all + + people.each do |person| + if person.diaspora_handle[-1, 1]=='@' && person.owner.nil? == false + person.diaspora_handle = person.owner.diaspora_handle + person.save + end + end + puts "everything should be peachy" + end end