Skip to content

Instantly share code, notes, and snippets.

@tjmcewan
Created June 25, 2011 05:36
Show Gist options
  • Save tjmcewan/1046199 to your computer and use it in GitHub Desktop.
Save tjmcewan/1046199 to your computer and use it in GitHub Desktop.
password resetter
namespace :db do
desc 'Reset all User passwords to "letmein"'
task :password_reset => :environment do
count = 0
User.all.each do |u|
u.password = u.password_confirmation = 'letmein'
if u.save
count += 1
print '.'
else
puts 'Error: ' + u
end
end
puts
puts 'Total passwords reset: ' + count.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment