Validating the User Model
Add basic validation rules for the users' parameters.
We'll cover the following...
We'll cover the following...
Create validation rules
In this lesson, we will update our model to define validation rules. These rules are described in the template in app/models/user.rb.
Ruby on Rails provides a complete validation mechanism in their official documentation.
For the User model, we only want to validate three things:
- The
emailmust be unique. - The
emailmust have a valid format. - The
passwordmust be filled in.
The following code defines ...