app/models/user.rb
# Callback before_save and before_update we only encrypt password if someone has entered a valid password
Callback before_save and before_update we only encrypt password if someone has entered a valid password
Callback before_save and before_update we only encrypt password if someone has entered a valid password
def encrypt_password
    if self.valid? && ! self.entered_password.blank?
      self.hashed_password = User.hash_password(self.entered_password)
    else
      return true 
    end
  end
def encrypt_password if self . valid? && ! self . entered_password . blank? self . hashed_password = User . hash_password ( self . entered_password ) else return true end end
Callback before_save and before_update we only encrypt password if someone has entered a valid password
Callback before_save and before_update we only encrypt password if someone has entered a valid password
# encryption not required but we don't want to halt the process