O'Reilly logo

RailsSpace: Building a Social Networking Website with Ruby on Rails™ by Aurelius Prochazka, Michael Hartl

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Friendships

With the double-blind email system in place, we suppose that RailsSpace is now technically a social network, but most real-world social networks worthy of the name give users a way to select preferred members. Following tradition, we call such distinguished users friends. Adding friends to RailsSpace is the goal of this chapter.

Friendships represent the most challenging data modeling problem we’ve encountered so far. To solve it, we’ll have to learn about simulated table names, foreign keys, and the has_many database association. Adding and managing friendships will then take place through both email and web interfaces. By the end of the chapter, we’ll be in a position to put a list of friends on the hub and user profile, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required