demarches-normaliennes/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake

12 lines
484 B
Ruby
Raw Normal View History

namespace :'2018_02_28_clean_invalid_emails_accounts' do
task clean: :environment do
Gestionnaire.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
2018-05-30 18:45:46 +02:00
Gestionnaire.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
end
User.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
2018-05-30 18:45:46 +02:00
User.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
end
end
end