Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CreateAdmin < V 1.1
- def self.up
- begin
- new_io = IO.new(0, "r")
- admin = {}
- puts "\nLog is about to create an admin user. Isn't that exciting?\n\n"
- print "Username: "
- admin[:name] = new_io.gets.chomp
- print "Password: "
- admin[:password] = new_io.gets.chomp
- User.create(admin)
- puts "\nOkay, all done!"
- rescue
- puts "\nAdding the user didn't work. You made the username too long or something."
- puts "Rolling back..."
- self.down
- exit
- end
- end
- def self.down
- User.delete(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement