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

This commit is contained in:
maxwell 2010-09-16 16:12:45 -07:00
parent e7afebece8
commit 1e8f10f1af

View file

@ -22,6 +22,7 @@ namespace :db do
require 'db/seeds/backer' require 'db/seeds/backer'
create create
end end
end end
desc 'Delete the collections in the current RAILS_ENV database' desc 'Delete the collections in the current RAILS_ENV database'
@ -53,4 +54,19 @@ namespace :db do
Rake::Task['db:seed:dev'].invoke Rake::Task['db:seed:dev'].invoke
puts "you did it!" puts "you did it!"
end 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 end