6.4 Conclusion

Starting from scratch, in this chapter we created a working User model
with name, email, and various password attributes, together with
validations enforcing several important constraints on their values. In
addition, we can securely authenticate users using a given password. In
previous versions of Rails, such a feat would have taken more than twice
as much code, but because of the compact validates method and
has_secure_password, we were able to build a complete User model using
less than a dozen lines of code.

In the next chapter, Chapter 7, we’ll make a working signup form to
create new users, together with a page to display each user’s
information. In Chapter 8, we’ll use the authentication machinery from
Section 6.3 to let users sign into the site.
6.4 Conclusion

Starting from scratch, in this chapter we created a working User model
with name, email, and various password attributes, together with
validations enforcing several important constraints on their values. In
addition, we can securely authenticate users using a given password. In
previous versions of Rails, such a feat would have taken more than twice
as much code, but because of the compact validates method and
has_secure_password, we were able to build a complete User model using
less than a dozen lines of code.

In the next chapter, Chapter 7, we’ll make a working signup form to
create new users, together with a page to display each user’s
information. In Chapter 8, we’ll use the authentication machinery from
Section 6.3 to let users sign into the site.
6.4 Conclusion

Starting from scratch, in this chapter we created a working User model
with name, email, and various password attributes, together with
validations enforcing several important constraints on their values. In
addition, we can securely authenticate users using a given password. In
previous versions of Rails, such a feat would have taken more than twice
as much code, but because of the compact validates method and
has_secure_password, we were able to build a complete User model using
less than a dozen lines of code.

In the next chapter, Chapter 7, we’ll make a working signup form to
create new users, together with a page to display each user’s
information. In Chapter 8, we’ll use the authentication machinery from
Section 6.3 to let users sign into the site.
6.4 Conclusion

Starting from scratch, in this chapter we created a working User model
with name, email, and various password attributes, together with
validations enforcing several important constraints on their values. In
addition, we can securely authenticate users using a given password. In
previous versions of Rails, such a feat would have taken more than twice
as much code, but because of the compact validates method and
has_secure_password, we were able to build a complete User model using
less than a dozen lines of code.

In the next chapter, Chapter 7, we’ll make a working signup form to
create new users, together with a page to display each user’s
information. In Chapter 8, we’ll use the authentication machinery from
Section 6.3 to let users sign into the site.