Skip to content

Instantly share code, notes, and snippets.

@artkirienko
Last active September 17, 2015 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artkirienko/b1fb21e4f11809ac5802 to your computer and use it in GitHub Desktop.
Save artkirienko/b1fb21e4f11809ac5802 to your computer and use it in GitHub Desktop.
run at your application path within rails console
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
@artkirienko
Copy link
Author

User.all.each do |u|
u.password = '12345678'
u.password_confirmation = '12345678'
u.save
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment