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:
parent
e7afebece8
commit
1e8f10f1af
1 changed files with 16 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue