Chapter 3. Modeling users

Having a front page up and running is a good start, but now it’s time to get to the core of any social networking site: a database of registered users. In the process, we’ll experience the remarkable power of models—the M in MVC—which, perhaps more than anything else, sets Rails apart from other frameworks.

The purpose of this chapter is to build a User model to represent RailsSpace users, deciding which attributes (such as screen names, email addresses, etc.) we want them to have. The User model will rely on Active Record, a library for communicating between Ruby objects and relational databases. We’ll spend much of the chapter exploring Active Record using the console, which is essentially a command line for Rails. ...

Get RailsSpace: Building a Social Networking Website with Ruby on Rails™ 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.