Next: Using Postgres to Make Our Login More Secure

Devise cannot absolutely prevent users from getting into our database that do not meet our security criteria. For example, Active Record provides the method update_attribute, which skips validations and could be used to insert a user with any email address into the USERS table. What we need is for the data layer itself to enforce our requirements.

Postgres’s check constraints can do this.

Get Rails, Angular, Postgres, and Bootstrap now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.