Last active
September 17, 2015 07:33
-
-
Save artkirienko/b1fb21e4f11809ac5802 to your computer and use it in GitHub Desktop.
run at your application path within rails console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = File.new("passwords", 'w') | |
User.all.each do |u| | |
psw = ([*('A'..'Z'),*('0'..'9')]-%w(0 1 I O)).sample(8).join | |
office = u.office_id.nil? ? " " : u.office.name | |
f.write("office: #{office} fio: #{u.first_name} #{u.middle_name} #{u.last_name} email: #{u.email} password: #{psw}\n\n") | |
u.password = psw | |
u.password_confirmation = psw | |
u.save | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
User.all.each do |u|
u.password = '12345678'
u.password_confirmation = '12345678'
u.save
end