💎 Ruby on Rails
Beginner
What is has_secure_password in Rails?
Answer
has_secure_password is an ActiveModel macro that adds password hashing using bcrypt. It adds password and password_confirmation virtual attributes, automatically hashes the password and stores it in a password_digest column, and adds an authenticate(plain_password) method that returns the user (or false) after BCrypt comparison. It validates presence of password on create and length (72 chars max). Requires the bcrypt gem. Use: user.authenticate(params[:password]) in your sessions controller.
Previous
What is concerns in Rails?
Next
What are Rails environments and how do you check the current one?