aboutsummaryrefslogblamecommitdiffstats
path: root/activemodel/test/models/user.rb
blob: fc4a9e433489bb321834ab3d47977e9546db20c9 (plain) (tree)
1
2
3
4
5
6
7
8
9

                             
          
                               
                                     
 
                                

                     
                                                            
 
                                                           






                                     
   
# 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