You are previewing Ruby on Rails™ 3 Tutorial: Learn Rails™ by Example.

Ruby on Rails™ 3 Tutorial: Learn Rails™ by Example

Cover of Ruby on Rails™ 3 Tutorial: Learn Rails™ by Example by Michael Hartl Published by Addison-Wesley Professional
O'Reilly logo

Chapter 7. Modeling and Viewing Users, Part II

In Chapter 6, we created the first iteration of a User model to represent users of our application, but the job is only half-done. Virtually any website with users, including ours, needs authentication as well, but currently any user signing up for the site would only have a name and email address, with no way to verify their identity. In this chapter, we’ll add the password attribute needed for an initial user signup (Chapter 8) and for signing in with an email/password combination (Chapter 9). In the process, we’ll re-use several of the ideas from Chapter 6, including migrations and validations, and also introduce some new ideas such as virtual attributes, private methods, and Active Record callbacks. ...

The best content for your career. Discover unlimited learning on demand for around $1/day.