User Model

Learn how to set up an authenticated user model using Devise, and how to create associations between your models.

Now that you have your Link structure set up, you need to set up your User structure.

To do this, you will need to do the following:

  1. Create a User model to handle user data
  2. Associate User and Link
  3. Add user_id attribute/column to Link

Generating the User model

Devise

To generate the user model, you will use a Ruby gem called Devise. Devise provides Rails with a simple way to add user authentication to applications.

You will get Devise to dump all its views to our Rails app. By default, these views are contained within the gem itself and thus are non-modifiable.

You will run the following command:

rails g devise:views

This will create a ...