RailsSpace: Building a Social Networking Website with Ruby on Rails™
by Michael Hartl, Aurelius Prochazka
Chapter 4. Registering users
Now that we’ve built the database back-end to store RailsSpace user information, it’s time to make a registration page to collect it. This will involve all three parts of the MVC architecture. The registration view will be dynamically generated by embedded Ruby using a Rails function specialized for producing HTML forms to interact with models. Once the form is submitted, the controller will use the form data to create a User model object. What happens next depends on whether the user is valid according to the criteria that we set in Section 3.2 when creating the User model: Valid users will be saved, resulting in a successful registration, while invalid users will be sent by the controller back to the registration ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access