Skip to content

Instantly share code, notes, and snippets.

@xkrsz
Created December 7, 2015 17:14
Show Gist options
  • Save xkrsz/a6e2be2b6f7513185b97 to your computer and use it in GitHub Desktop.
Save xkrsz/a6e2be2b6f7513185b97 to your computer and use it in GitHub Desktop.
Generator userów do rails
#!/usr/bin/ruby
puts "Elo, chcesz zrobic [u]czniow czy [a]dministratorow?"
type = gets.chomp
case type
when "u"
puts "Ok, ilu uczniow chcesz zrobic?"
number = gets.chomp.to_i
file = File.open("uczniowie.qtaz", 'w')
for i in 1..number
file.write("user = User.create! :email => 'uczen#{i}@test.pl', :password => 'password#{i}', :password_confirmation => 'password#{i}'\n")
end
when "n"
puts "Ok, ilu nauczycieli chcesz zrobic?"
number = gets.chomp.to_i
file = File.open("nauczyciele.qtaz", 'w')
for i in 1..number
file.write("user = Admin.create! :email => 'nauczyciel#{i}@test.pl', :password => 'password#{i}', :password_confirmation => 'password#{i}'\n")
end
else
puts "wpisz u albo n"
end
puts "Plik zostal stworzony w aktualnej lokalizacji"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment