method

password=

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: InstanceMethodsOnActivation

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.2.3) is shown here.

password=(unencrypted_password) public

Encrypts the password into the password_digest attribute, only if the new password is not empty.

class User < ActiveRecord::Base
  has_secure_password validations: false
end

user = User.new
user.password = nil
user.password_digest # => nil
user.password = 'mUc3m00RsqyRe'
user.password_digest # => "$2a$10$4LEA7r4YmNHtvlAvHhsYAeZmk/xeUVtMTYqwIvYY76EW5GUqDiP4."
Show source
Register or log in to add new notes.