1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activemodel/test/models/user.rb
Ryuta Kamizono 50fba828d5 Refactor has_secure_password to extract dedicated attribute module
Follow up of #26764 and #35700.

And add test case for #35700.
2019-04-05 01:55:00 +09:00

20 lines
444 B
Ruby

# frozen_string_literal: true
class User
extend ActiveModel::Callbacks
include ActiveModel::SecurePassword
define_model_callbacks :create
has_secure_password
has_secure_password :recovery_password, validations: false
attr_accessor :password_digest, :recovery_password_digest
attr_accessor :password_called
def password=(unencrypted_password)
self.password_called ||= 0
self.password_called += 1
super
end
end