fix superadmin rake
This commit is contained in:
parent
398ec7d99a
commit
2ee5b1f6cb
1 changed files with 6 additions and 6 deletions
|
@ -5,8 +5,8 @@ namespace :superadmin do
|
||||||
List all super-admins
|
List all super-admins
|
||||||
EOD
|
EOD
|
||||||
task list: :environment do
|
task list: :environment do
|
||||||
rake_puts "All Administrations:"
|
rake_puts "All SuperAdmins:"
|
||||||
Administration.all.pluck(:email).each do |a|
|
SuperAdmin.all.pluck(:email).each do |a|
|
||||||
puts a
|
puts a
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,8 +17,8 @@ namespace :superadmin do
|
||||||
task :create, [:email] => :environment do |_t, args|
|
task :create, [:email] => :environment do |_t, args|
|
||||||
email = args[:email]
|
email = args[:email]
|
||||||
|
|
||||||
rake_puts "Creating Administration for #{email}"
|
rake_puts "Creating SuperAdmin for #{email}"
|
||||||
a = Administration.new(email: email, password: Devise.friendly_token)
|
a = SuperAdmin.new(email: email, password: Devise.friendly_token)
|
||||||
|
|
||||||
if a.save
|
if a.save
|
||||||
rake_puts "#{a.email} created"
|
rake_puts "#{a.email} created"
|
||||||
|
@ -34,8 +34,8 @@ namespace :superadmin do
|
||||||
EOD
|
EOD
|
||||||
task :delete, [:email] => :environment do |_t, args|
|
task :delete, [:email] => :environment do |_t, args|
|
||||||
email = args[:email]
|
email = args[:email]
|
||||||
rake_puts "Deleting Administration for #{email}"
|
rake_puts "Deleting SuperAdmin for #{email}"
|
||||||
a = Administration.find_by(email: email)
|
a = SuperAdmin.find_by(email: email)
|
||||||
a.destroy
|
a.destroy
|
||||||
rake_puts "#{a.email} deleted"
|
rake_puts "#{a.email} deleted"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue