Guest User

Untitled

a guest
Jul 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. include Rails.application.routes.url_helpers
  2.  
  3. begin
  4. namespace :admin do
  5. task :create => :environment do
  6. puts "You will be prompted to enter an email address and password for the new admin"
  7. puts "Enter an email address:"
  8. email = STDIN.gets
  9. puts "Enter a password:"
  10. password = STDIN.gets
  11. unless email.strip!.blank? || password.strip!.blank?
  12. if Admin.create!(:email => email, :password => password)
  13. puts "The admin was created successfully. Log in at #{new_admin_session_path}"
  14. else
  15. puts "Sorry, the admin was not created!"
  16. end
  17. end
  18. end
  19. end
  20. end
Add Comment
Please, Sign In to add comment