fix_diaspora_handle rake task

This commit is contained in:
Raphael 2010-09-22 22:57:53 -07:00
parent 2a2d126ff3
commit 494f765066

View file

@ -58,19 +58,12 @@ namespace :db do
task :fix_diaspora_handle do
puts "fixing the people in this seed"
require 'config/environment'
people = Person.all( '$where' => "function(){
return this.diaspora_handle.charAt(this.diaspora_handle.length-1) == '@'
}")
puts "Found #{people.count} people with broken diaspora_handle fields"
people.each do |person|
Person.where(:url => 'example.org').all.each{|person|
if person.owner
puts "Resetting diaspora handle for #{person.owner.username}"
person.url = APP_CONFIG[:pod_url]
person.diaspora_handle = person.owner.diaspora_handle
person.save
end
end
}
puts "everything should be peachy"
end
end