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.



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

def initialize(user)
  self.user = user
end

Instance Attribute Details

#userObject

Returns the value of attribute user.



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

def user
  @user
end

Class Method Details

.run!Object



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

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

Instance Method Details

#update!Object



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

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