demarches-normaliennes/lib/tasks/admin.rake
2017-12-22 11:10:25 +01:00

12 lines
364 B
Ruby

namespace :admin do
task :create_admin, [:email] => :environment do |t, args|
email = args[:email]
puts "Creating Administration for #{email}"
a = Administration.new(email: email, password: Devise.friendly_token[0,20])
if a.save
puts "#{a.email} created"
else
puts "An error occured : #{a.errors.full_messages}"
end
end
end