Building Social Features in Ruby on Rails
In our first Ruby on Rails project, we started building a simple social network called Treebook. Now we're ready to add friendships, friend lists, and AJAX features using intermediate features of the Ruby on Rails application framework.
5 badges • 26 videos
-
Creating Friendships
Let's add social features to Treebook! In this stage we're going to add friendships to our Treebook application. We'll start by creating a friendship model as well as learn what a join model and join table are.
-
Building the Friendship UI
Now that we have our friendship models created and tested, we need to build the front-end to let users friend each other. We'll start by creating a controller for user friendships and integrating that in to the application routes. Finally, we'll hook up the models to the new controller.
-
Adding State
It is important to be able to respond to different events in our friendship model. For example, when a user sends a friend request to another user, we want the requestee to get an email. We're going to use something called a state machine to manage this.
-
Using AJAX
Treebook is now working pretty well and allows users to friend each other. With all of this functionality in place, let's spice things up by adding some AJAX to our site for remote JavaScript interactions.
-
Managing Friendships
In this stage, we're going to allow users to manage their friends. We'll provide a new interface for listing, deleting, and blocking friends.