Module: Devise::Models::Encryptable::ClassMethods

Defined in:
lib/devise/models/encryptable.rb

Instance Method Summary collapse

Instance Method Details

#encryptor_classObject

Returns the class for the configured encryptor.



55
56
57
58
59
60
61
62
63
64
# File 'lib/devise/models/encryptable.rb', line 55

def encryptor_class
  @encryptor_class ||= case encryptor
    when :bcrypt
      raise "In order to use bcrypt as encryptor, simply remove :encryptable from your devise model"
    when nil
      raise "You need to give an :encryptor as option in order to use :encryptable"
    else
      ::Devise::Encryptors.const_get(encryptor.to_s.classify)
  end
end

#password_saltObject



66
67
68
# File 'lib/devise/models/encryptable.rb', line 66

def password_salt
  self.encryptor_class.salt(self.stretches)
end