Improve super admin management

This commit is contained in:
Mathieu Magnin 2018-01-03 11:45:19 +01:00
parent 582b7bf889
commit 4c8c26f250
2 changed files with 26 additions and 0 deletions

View file

@ -9,4 +9,19 @@ namespace :admin do
puts "An error occured : #{a.errors.full_messages}"
end
end
task list: :environment do
puts "All Administrations :"
Administration.all.pluck(:email).each do |a|
puts a
end
end
task :delete_admin, [:email] => :environment do |t, args|
email = args[:email]
puts "Deleting Administration for #{email}"
a = Administration.find_by(email: email)
a.destroy
puts "#{a.email} deleted"
end
end