January 2016
Intermediate to advanced
240 pages
7h 36m
English
If we look at the User model that Devise created for us, we can see that a Devise-provided method named devise is being used. This is how you can control the behaviors Devise uses for registration and authentication on a per-model basis.
| | class User < ActiveRecord::Base |
| | devise :database_authenticatable, |
| | :registerable, |
| | :recoverable, |
| | :rememberable, |
| | :trackable, |
| » | :validatable |
| | end |
The :validatable module is what we’re interested in. By using this in our model, Devise will set up various validations for the model, namely that the password is at least eight characters and that the email address looks like an email address. These defaults are set ...
Read now
Unlock full access