O'Reilly logo

Rails, Angular, Postgres, and Bootstrap, 2nd Edition by David B. Copeland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating Registration

If you look at the User model that Devise created, you 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. Note the :validatable symbol in the list.

 class​ User < ApplicationRecord
  devise ​:database_authenticatable​,
 :registerable​,
 :recoverable​,
 :rememberable​,
 :trackable​,
»:validatable
 end

This :validatable module is what we’re interested in. By using this in our model, Devise sets up various validations for the model, namely that the password is at least eight characters and that the email address looks like an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required