Validating the User Model
Add basic validation rules for the users' parameters.
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
email
must be unique. - The
email
must have a valid format. - The
password
must be filled in.
Get hands-on with 1400+ tech skills courses.