Building a social network on Rails
By: Blog Moove-It
Tags: Tog, Social Network, Rails

So you want to build your own social network site on rails? As you probably know, there are many plugins around to add social functionality to your site, and there are also some open source platforms that provide you with complete social network functionality. Some of them are Lovd by Less, comunity engine, tog, etc. These platforms, as rails premises, are based in the idea of not reinventing the wheel. In this post we’ll be referring about tog our experience installing it and trying it out.

Why are we using tog? Actually we are not using it, we are just doing a proof of concept trying out the different platforms and getting to know each of them. The idea behind this is to have enough knowledge to, according to our clients requirements, select the best solution for them and for us in order to save our clients some money by reducing our development time.

What is tog? Tog is a non-intrusive, extensible open source platform that helps you to add social network features to your Ruby on Rails apps. We aim to convert the tedious and long process of creating a community site on a straightforward process that will give your site social capabilities in minutes. (from www.toghq.com/)

Installing tog may not be a simple procedure for a Rails beginner, but the install process is very well explained in their wiki. After following the procedure you will have installed a very complete and expandable social network. It is composed by many plugins developed by tog and some by 3rd parties. After installing the basic plugins you can install more plugins that will easily adapt to the default site.

Tog is today in version 0.4, which means you will probably find some bugs and things to fix. Here are some we ran into:

After running the togify command the following error may appear: “error There has been a problem trying to unpack the tog_core tarball downloaded from github. Remove the changes made on your app by togify and try again. Sorry for the inconveniences. We found the solution in the project assembla here In the migration create_posts from plugin tog_conversation the line t.datetime :published_at is missing

Another thing you shouldn’t forget is to set up your email conf, since some plugins may depend on the user activation like the message ones (I tried to manually activate some users, and then had to manually fix some things than an observer was supposed to do after activation)

The greatest thing about tog is the ease of extending it. You can read about it here. Basically you can override any behavior you want just by creating models, controllers or views like you would normally do in your apps. On the cons side, it may be a bit complex finding out what functionality is where, to override with your own. The idea is to not touch the plugins and use new controllers, models, etc to extend. This will allow plugins to be updated when they need to, without affecting your site’s working functionality.

In conclusion, I think tog is a very promising platform that may be a great solution for building social networks on the go, allowing us to extend them to meet our needs. This may be a good solution for a user who just wants his site running. If you want to customize too much about it, you should consider other platform or starting from scratch.

We are right now working on adding Facebook Connect to a demo site we are building with tog, please come back to know how that went ;)