So far thanks to this chapter we already have lists of users and the functionality for our users to build relationships. Now we need to combine these to build a friends list for our users. This would either be a user viewing their own friends, or viewing the friends of another user.
To view our own friends, we would visit http://oursite/relationships. This would call our relationship controller's default method, which needs to get our friends and display them on the page.
In our model, we need a query that looks up all relationships where we are either
userb, and depending on which we are, looks up the details of our connection from the other user field. This is done with a simple IF statement within the query. ...