Locked lesson.
About this lesson
Allow people to sign up to your site, log in, and log out. Part 2.
Exercise files
Download this lesson’s related exercise files.
Devise Installation Part 2.docx58.8 KB Devise Installation Part 2 - Solution.docx
58.6 KB
Quick reference
Devise Installation Part 2
In this video we'll continue to install the Devise gem and set up our User model.
When to use
Devise is used to handle user management for our website.
Instructions
To continue installing Devise, run this command from your terminal to create a database migration:
rails generate devise user
Next: add this line to your newly created migration:
t.string :name, null: false, default: ""
Next: push your newly created migration to the local database:
rake db:migrate
Next: push your migration to the production database at Heroku:
heroku run rake db:migrate
Hints & tips
- Remember, creating a database is a 2-step process (1. create a migration 2. push the migration into the database)
- rails generate devise user To generate a user model migration
- rake db:migrate to push our migration into the local database
- heroku run rake db:migrate to push our migration into the Heroku production database
- Don't forget to add a name field to the migration file before you push it
Lesson notes are only available for subscribers.