demarches-normaliennes/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake
2019-09-12 14:48:18 +02:00

11 lines
488 B
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace :'2018_02_28_clean_invalid_emails_accounts' do
task clean: :environment do
Gestionnaire.pluck(:email, :id).filter { |e, _id| e.include?(" ") }.each do |_email, id|
Gestionnaire.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
end
User.pluck(:email, :id).filter { |e, _id| e.include?(" ") }.each do |_email, id|
User.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
end
end
end