User Model
Learn how to set up an authenticated user model using Devise, and how to create associations between your models.
We'll cover the following...
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:
- Create a
User
model to handle user data - Associate
User
andLink
- Add
user_id
attribute/column toLink
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 ...