Learn

What did we just do?

  1. We created a model named User.
  2. In the model, we used the method has_secure_password. This method adds functionality to save passwords securely.
  3. In order to save passwords securely, has_secure_password uses an algorithm called bcrypt. To use bcrypt, we added the bcrypt gem to the Gemfile.

Now that the User model is set up, let’s continue by adding columns to the migration files.

Instructions

1.

Open the migration file in db/migrate/ for the users table and add:

  • a string column called first_name
  • a string column called last_name
  • a string column called email
  • a string column called password_digest
2.

Run a migration to update the database.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?