Set the same password for all users in one query
Public
11 Sep 08:24

namespace :debug do
  desc 'Resets all user passwords to a specified value'
  task reset_passwords: :environment do
    unless Rails.env.development?
      puts 'This task can only be run in development'
      exit 0
    end

    pass = User.new(password: 'new_password').encrypted_password
    User.update_all(encrypted_password: pass)
  end
end

Comments

Joe
wolf
Nice trick! Good to know that such thing is possible!