ylluminate ylluminate - 2 months ago 30
Ruby Question

Devise password reset from Rails console

While running an app how do you select a user by email address and then set the password manually within

rails console
for Devise?

Also, where would I go to review documentation to cover more details in this regard to manipulation of accounts while using Devise?

Answer

It's more or less as you described :-)

# use mongoid
class User
  include Mongoid::Document
end


# then
user = User.where(:email => email).first

if user
  user.password = new_password
  user.password_confirmation = new_password
  user.save
end