Class: MinimalistAuthentication::Conversions::MergePasswordHash

Inherits:
Object
  • Object
show all
Defined in:
lib/minimalist_authentication/conversions/merge_password_hash.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ MergePasswordHash

Returns a new instance of MergePasswordHash.



24
25
26
# File 'lib/minimalist_authentication/conversions/merge_password_hash.rb', line 24

def initialize(user)
  self.user = user
end

Instance Attribute Details

#userObject

Returns the value of attribute user.



20
21
22
# File 'lib/minimalist_authentication/conversions/merge_password_hash.rb', line 20

def user
  @user
end

Class Method Details

.run!Object



7
8
9
10
11
# File 'lib/minimalist_authentication/conversions/merge_password_hash.rb', line 7

def run!
  user_model.where(using_digest_version: 3, password_hash: nil).find_each do |user|
    new(user).update!
  end
end

Instance Method Details

#update!Object



28
29
30
# File 'lib/minimalist_authentication/conversions/merge_password_hash.rb', line 28

def update!
  user.update_column(:password_hash, merged_password_hash)
end