[Fix #1479] Task to clean invalid emails
This commit is contained in:
parent
f30bb4f9fb
commit
9910e19c20
1 changed files with 11 additions and 0 deletions
11
lib/tasks/2018_02_28_clean_gestionnaire_emails.rake
Normal file
11
lib/tasks/2018_02_28_clean_gestionnaire_emails.rake
Normal file
|
@ -0,0 +1,11 @@
|
|||
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|
|
||||
Gestionnaire.find_by(id: id, current_sign_in_at: nil).try(:destroy) # ensure account was never used
|
||||
end
|
||||
|
||||
User.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
||||
User.find_by(id: id, current_sign_in_at: nil).try(:destroy) # ensure account was never used
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue