Building a Social Network Site in Rails

April 25th, 2008

I’m not going to cover how to actually code an entire social network site in rails as all social network sites vary in their functionality (and it’ll take too long). I will cover plugins and other things you might find useful though.

Quick Start

If you don’t really want to do the coding but want to get a site up and running and soon as possible, you may want to have a look at Lovd by Less by the guys over at Less Everything. Lovd by Less contains user signups, galleries, blogs, comments and various other things that you might want, so it’s a great starting block for your site.

Social Network Plugins

Here’s a list of plugins that I’ve found to be useful while coding my own social networking site:

Restful Authentication

RESTful Authentication is pretty much the defacto standard for user authentication in rails. It allows easily set up user signups, login functionality and email notifications. The plugin doesn’t set up thing’s like forgotten password functionality but there is a great tutorial over Rails Forum.

# To Install
ruby script/plugin source http://svn.techno-weenie.net/projects/plugins
ruby script/plugin install restful_authentication
Paperclip

Paperclip is a brilliant plugin by Jon Yurek over at ThoughtBot. Paperclip is used for managing file uploads and attaching the files to models. You can read more over at my article: Paperclip: Attaching Files in Rails.

# To Install
svn export https://svn.thoughtbot.com/plugins/paperclip/tags/rel_2-0-2
piston import https://svn.thoughtbot.com/plugins/paperclip/trunk
Will_paginate

Will paginate is a great plugin for allowing paging of your records. Paging is a pain in the ass, but will_paginate makes it easy as pie.

# To Install
ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate
Acts_as_slugable

Acts_as_slugable takes the pain out of generating URL slugs. Everyone prefers meaningful URLs, so instead of showing a users page with ‘/users/231′, you can use ‘/users/jim-neath’. Nice.

# To Install
ruby script/plugin install http://code.dunae.ca/acts_as_slugable
White_list

White_list is yet another brilliant from Techno Weenie. The white_list helper will html encode all tags and strip all attributes that aren’t specifically allowed. It also strips href/src tags with invalid protocols, like javascript: especially. It does its best to counter any tricks that hackers may use, like throwing in unicode/ascii/hex values to get past the javascript: filters.

# To Install
ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/white_list/
Acts_as_commentable

Acts_as_commentable allows you to add comments to your models. It takes care of all the polymorphic associations for you, which is nice.

# To Install
ruby script/plugin install http://juixe.com/svn/acts_as_commentable
ReCAPTCHA

Fucking captchas. Unfortunately a necessary evil. If you’re going to use captchas then you might as well help to digitalise books. The reCAPTCHA plugin utilises the reCAPTCHA service which digitalises books by making users input the text.

# To Install
ruby script/plugin install svn.ambethia.com/pub/rails/plugins/recaptcha/
Acts_as_taggable_on_steroids

Everybody loves tagging, surely? Tag pictures, videos, blog posts, whatever you want. Acts_as_taggable_on_steroids is a great plugin for allowing your users to tag their stuff. It allows tag clouds and all that web 2.0 jazz everyone seems to love.

# To Install
ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids
Exception Notifier

Exception Notifier is a must have. It emails you when your live application fails. No matter how much testing you do, no doubt there’s going to be a scenario where it fails and when that happens you want to know.

# To Install
ruby script/plugin install exception_notification
Throttler

This is one of my favourite plugins. Say your site get’s slashdotted of dugg and you end up with immense traffic, the main thing is to keep your site up and running. This is where throttler comes in. You can throttle certain actions on your site when your server load is above a certain level. So you could disable video uploads while your server load is above x to prevent your server from crumbling.

# To Install
ruby script/plugin install http://svn.kabisa.nl/rails/plugins/throttler
Backup_fu

You’ve been working on your social network site for months and finally the traffic is coming in and you have a decent user base. Then one day your server dies and you lose all your data. Woe is you. You should have backed up. Using Backup_fu you can automatically backup your database and files to Amazon S3.

# To Install
sudo gem install aws-s3
ruby script/plugin install http://backup-fu.googlecode.com/svn/backup_fu/
Fischy Friends

Fischy_friends is a plugin by Daniel Fischer. It’s a great starting point for a friends system. I’ve used it on a couple of my own projects and it’s worked great for me.

# Github
http://github.com/dfischer/fischyfriends/tree/master

Other Useful Tools

SWFUpload

I love SWFUpload. It uses a small flash file to allow users to upload multiple files at once. The front end is completely open and coded in javascript so you can customise it how you like. You can see the demos here.

Download: http://swfupload.googlecode.com/files/SWFUpload%20v2.0.2.Release.zip

TinyMCE Text Editor

TinyMCE is WYSIWYG editor coded entirely in javascript. It’s useful for the less techno savvy of your users (which will no doubt be most). There’s a whole load of plugins available for the editor so it’s highly extensible.

Download: http://prdownloads.sourceforge.net/tinymce/tinymce_3_0_7.zip?download

FFMPEG/Mencoder

FFMPEG is a command line utility to convert various formats of video into other formats. The main use you’ll want to use this for is to convert videos into flv files for use with a flash video player.

JW FLV Media Player

The JW FLV Media Player (built with Adobe’s Flash) is an easy and flexible way to add video and audio to your website. It supports playback of any format the Adobe Flash Player can handle (FLV, but also MP3, H264, SWF, JPG, PNG and GIF). It also supports RTMP and HTTP (Lighttpd) streaming, RSS, XSPF and ASX playlists, a wide range of flashvars (variables), an extensive javascript API and accessibility features.

Rails Hosting

Once you’ve got your wonderful social network finished, you’re going to want somewhere to host the beast.

I highly recommend checking out Brightbox for all your hosting needs. They offer affordable servers complete with Five Runs.

Books

RailsSpace: Building a Social Networking Website with Ruby on Rails

“Ruby on Rails is fast displacing PHP, ASP, and J2EE as the development framework of choice for discriminating programmers, thanks to its elegant design and emphasis on practical results. RailsSpace teaches you to build large-scale projects with Rails by developing a real-world application: a social networking website like MySpace, Facebook, or Friendster.

Inside, the authors walk you step by step from the creation of the site’s virtually static front page, through user registration and authentication, and into a highly dynamic site, complete with user profiles, image upload, email, blogs, full-text and geographical search, and a friendship request system. In the process, you learn how Rails helps you control code complexity with the model-view-controller (MVC) architecture, abstraction layers, automated testing, and code refactoring, allowing you to scale up to a large project even with a small number of developers.

This essential introduction to Rails provides

  • A tutorial approach that allows you to experience Rails as it is actually used
  • A solid foundation for creating any login-based website in Rails
  • Coverage of newer and more advanced Rails features, such as form generators, REST, and Ajax (including RJS)
  • A thorough and integrated introduction to automated testing

The book’s companion website provides the application source code, a blog with follow-up articles, narrated screencasts, and a working version of the RailSpace social network.”

(Possibly) Related Posts

Recommend Me

If you found this post or anything else on this site of any use, then please take the time to recommend me on Working with Rails.

You can follow any responses to this entry through the RSS 2.0 feed. Trackback from your own site.

46 Responses to “Building a Social Network Site in Rails”

  1. April 25th, 2008 at 12:48 pm - Mike Breen Says:

    +1 for SWFUpload. We just implemented it on a .NET project because the available .NET components blow.

    Good post. it’s nice to have these plugins all in one place. Thanks.


  2. April 25th, 2008 at 2:26 pm - Brandon Says:

    Looks like a great list. I am using a lot of the same on my project. Thanks for the blog!


  3. April 25th, 2008 at 2:44 pm - Luke Hartman Says:

    Jim,

    Thanks for pooling these in once place. I’m about to teach some coworkers Rails so we can migrate away from .NET. I appreciate you putting this together.


  4. April 25th, 2008 at 3:22 pm - Jonathan Says:

    Thanks Jim for the fantastic list. Very helpful.

    @Luke – I too am trying to move my development team away from .NET and onto Rails :)


  5. April 25th, 2008 at 4:00 pm - remi Says:

    lol … i might as well join the party and mention: i *DID* move away from .NET and to Rails :)

    Great List!!


  6. April 25th, 2008 at 4:14 pm - Jim Neath Says:

    Looks like everyone is moving away from .NET :)

    You guys should check out Jacques Crockers Acts as .NET plugin :)


  7. April 25th, 2008 at 5:19 pm - Pat Nakajima Says:

    permalink_fu is another great plugin for generating permalinks. I’ve found it to be a bit easier to use than acts_as_sluggable. Here’s its github page: http://github.com/technoweenie/permalink_fu


  8. April 25th, 2008 at 6:35 pm - Building a Social Network Site in Rails | Jim Neath • ayn blog Says:

    [...] Friday April 25th • Random stuff Category This is pretty useful, I am working on another site but it won’t be much of a social site, but I am definitely using quite a few of the plugins in this list. (instead of acts_as_taggable_on_steroids we’re trying to use acts_as_taggable_on). Building a Social Network Site in Rails | Jim Neath [...]


  9. April 25th, 2008 at 9:17 pm - Marco Says:

    social network sites seem to be the only things you can do with rails …


  10. April 25th, 2008 at 11:12 pm - social on rails — award tour Says:

    [...] Building a Social Network Site in Rails | Jim Neath. big list of plugins you would find useful if you were building a social site. [...]


  11. April 26th, 2008 at 1:34 am - links for 2008-04-26 « Bloggitation Says:

    [...] Building a Social Network Site in Rails (tags: ruby rails programming) [...]


  12. April 26th, 2008 at 1:44 am - links for 2008-04-26 « Mike Does Tech Says:

    [...] Building a Social Network Site in Rails | Jim Neath A nice collection of plugins and more good content from Jim Neath (tags: socialnetwork rubyonrails plugins) [...]


  13. April 26th, 2008 at 5:30 am - links for 2008-04-26 « Donghai Ma Says:

    [...] Building a Social Network Site in Rails | Jim Neath (tags: rails ruby plugins socialnetworking) [...]


  14. April 26th, 2008 at 7:30 am - links for 2008-04-26 « I do Says:

    [...] Building a Social Network Site in Rails | Jim Neath (tags: rails code plugins development social) [...]


  15. April 26th, 2008 at 7:39 am - links for 2008-04-26 | Libin Pan Says:

    [...] Building a Social Network Site in Rails | Jim Neath Building a Social Network Site in Rails (tags: rails ruby socialnetworking rubyonrails development) [...]


  16. April 26th, 2008 at 1:30 pm - links for 2008-04-26 | manicwave.com Says:

    [...] Building a Social Network Site in Rails | Jim Neath Ruby on Rails, Javascript, CSS and Standards Building a Social Network Site in Rails April 25th, 2008 I’m not going to cover how to actually code an entire social network site in rails as all social network sites vary in their functionality (and it’ll (tags: rails site ruby social-networking) [...]


  17. April 28th, 2008 at 5:02 am - This Week in Ruby (April 28, 2008) | Zen and the Art of Programming Says:

    [...] of them, but if you don’t, it’s a good idea to learn about them now. The second is Building a Social Network Site in Rails, which is not a step-by-step guide, but rather a list of useful resources for building such a site. [...]


  18. April 29th, 2008 at 3:00 pm - Skiptree Thoughts » Blog Archive » acts_as_social Says:

    [...] If you are plotting your own social networking site, you absolutely have to travel to his blog entry on the subject!  If you are the really lazy type, just go get a social network site that you [...]


  19. April 30th, 2008 at 4:24 am - Chris Johnston Says:

    Nice list, I am going to have to try some of these out. I have used acts_as_authenticated, which I like, but I am going to have to make the move to restful_authentication very soon. As for the others, I just need to think of the right project for them (hmm…, a blog maybe ;-) )


  20. May 1st, 2008 at 1:45 am - links for 2008-05-01 at adoption curve dot net Says:

    [...] Building a Social Network Site in Rails | Jim Neath List of useful plugins (tags: rails rubyonrails plugins) Filed under del.icio.us | [...]


  21. May 1st, 2008 at 5:32 pm - sublimeguile – links for 2008-05-01 Says:

    [...] Building a Social Network Site in Rails | Jim Neath [...]


  22. May 1st, 2008 at 8:10 pm - Stephen Says:

    Check out ActsAsNetwork. Its a plugin that drastically simplifies the storage and manipulation of bidirectional “friend” relationships that naturally occur in social networks. http://actsasnetwork.rubyforge.org/


  23. May 7th, 2008 at 4:48 pm - giorgi Says:

    I would also recommend restful acl plugin ( http://github.com/mdarby/restful_acl/wikis ) that is extrends the aforementioned Restful Authentication.


  24. May 7th, 2008 at 6:40 pm - Matthew Says:

    Some of these plugins confuse me. Actsascommentable, actassluggable. Why would I want plugins for code I can write myself in five minutes. I hate black boxes of stuff I don’t have as much control over. Even will_paginate bugs me right now, but that more because they converted over to a gem and I have yet to understand how to hack it in that format.


  25. May 7th, 2008 at 7:35 pm - A good list of rails plugins from Jim Neath Says:

    [...] http://jimneath.org/2008/04/25/building-a-social-network-site-in-rails/ Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages. [...]


  26. May 8th, 2008 at 9:49 am - martin.karlsch Says:

    nice post! our plugin list is nearly the same :) a plugin I would suggest is preference_fu (if you want to store many boolean settings like which notification a user wants to receive)


  27. May 8th, 2008 at 10:32 am - Jim Neath Says:

    @Matthew – I added those plugins for people who don’t want to spend the time writing code that’s already available.

    Acts_as_commentable is useful for people who don’t really understand how to use polymorphic associations and the like.

    Acts_as_slugable is good for people who hate/suck at regex.

    @Martin – preference_fu sounds like a decent plugin. Will read up about it and add it to the list with a couple of other plugins I forgot to add with the original post.


  28. May 19th, 2008 at 1:19 am - Juixe TechKnow » This Week in Ruby Says:

    [...] Building a Social Network Site in Rails [...]


  29. May 20th, 2008 at 5:06 pm - Dan Castro Says:

    This is for Jim Neath.

    I’m looking for someone with lots of experience using Ruby on Rails to create a social networking site from scratch.

    Would you be interested in giving us a bid?

    Please contact me privately at danmancastro@gmail.com

    Thanks,
    Dan Castro
    Austin, Texas
    512-732-0111


  30. May 21st, 2008 at 9:06 am - Jim Neath Says:

    Hi Dan,

    As much as I would love to, I’m currently up to my eyeballs in work, so alas do not have the time.

    I hope you find someone. You could always try looking into Lovd By Less

    - Jim


  31. May 30th, 2008 at 6:31 am - Mr. Bless Says:

    Great work.


  32. June 2nd, 2008 at 12:12 pm - Converting Videos with Rails: Installing FFMPEG | Ruby on Rails Says:

    [...] This is the first of a three part series covering how to convert videos using the marvellous FFMPEG library. Video converison is a must have if you are planning on creating a social network site. [...]


  33. June 3rd, 2008 at 1:14 am - » links for 2008-04-26 | Paul Cowles Says:

    [...] Building a Social Network Site in Rails | Jim Neath (tags: SocialNetworking rails plugins) [...]


  34. June 10th, 2008 at 10:24 am - Two Mad Geeks » Building A Social Network Site In Rails Says:

    [...] Link: Jim Neath [...]


  35. July 7th, 2008 at 3:26 am - mhd » Blog Archive » Ruby on Rails - Resources Says:

    [...] Building a Social Network Site in Rails By Jim Neath http://jimneath.org/2008/04/25/building-a-social-network-site-in-rails/ [...]


  36. July 9th, 2008 at 10:20 pm - chrisci Says:

    Any comments on http://www.lovdbyless.com vs. http://insoshi.com/? Thanks.


  37. July 10th, 2008 at 1:13 am - Paper Bits – links for 2008-07-01 Says:

    [...] Building a Social Network Site in Rails | Ruby on Rails Exhaustive list of plugins and resources that will come in handy if you’re building a site in RoR that involves a social network of some form. (tags: howto reference rails plugins) [...]


  38. July 11th, 2008 at 9:32 am - Jaime Iniesta Says:

    What a great list! If I had it some months ago… In my current social networks projects I also include acts_as_taggable_on_steroids for the tags, ultrasphinx for the searches, and ar_mailer and simplified_starling for long-processing jobs like sending emails to thousands of users in background.


  39. August 6th, 2008 at 7:58 am - Personal Trainer Says:

    Thanks for the list, might use some in my next project. For those pesky thumbnails I used RMagick and jsCropper. Check out the latter at http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/.


  40. August 8th, 2008 at 7:06 pm - alldevnet.com Says:

    Building a Social Network Site in Rails | Ruby on Rails…

    This covers how to actually code an entire social network site in rails as all social network sites vary in their functionality. It covers plugins and other things you might find useful….


  41. September 25th, 2008 at 2:06 am - Aaron Sumner Says:

    Thanks for this great list and your other articles–I’ve been frequenting your site over the last few weeks. Just wondering if anyone knows of a good plugin that would help with tracking user activities across several models, like “Aaron added a bookmark to foo.com” and “Jane left a comment in the ‘What’s everyone want for dinner?’ topic,” etc.

    Thanks,
    Aaron


  42. November 26th, 2008 at 4:10 pm - webdesign Says:

    Awesome list, Thanks for socializing me :)


  43. December 2nd, 2008 at 1:34 pm - Hail Says:

    Hi does anyone know where I can get some webcam function plugins, I want to start a webcam adult site. I need a plugin that lets my models set up their webcam and I need a plugin that has the pay system function so we both get paid.


  44. March 9th, 2009 at 4:49 am - Ruby on Rails Topic: Issue with Paperclip installation | Jojo Siao Says:

    [...] Jim Neath has also a blog post regarding creating Social Networking Sites in Ruby on Rails. url: http://jimneath.org/2008/04/25/building-a-social-network-site-in-rails/ [...]


  45. March 22nd, 2009 at 3:03 pm - links for 2009-03-22 « Brent Sordyl’s Blog Says:

    [...] Building a Social Network Site in Rails | Ruby on Rails I’m not going to cover how to actually code an entire social network site in rails as all social network sites vary in their functionality (and it’ll take too long). I will cover plugins and other things you might find useful though. (tags: rubyonrails socialnetworking) [...]


  46. April 14th, 2009 at 12:44 pm - Why I’m no longer excited about BuddyPress (or Elgg, or MT 4.2) « Aaron Sumner Says:

    [...] That’s why I decided to forego what’s out there now and write my own thing. (OK, also, none of those above are Ruby and/or Rails in nature.) Over the last couple of weeks, in pockets, I’ve been developing a social network for people who don’t think social networks can be useful. (Screenshots pending.) It’s got groups, discussions, user profiles, and rudimentary social functionality (interested in a particular topic? Click it to see who else in your workplace might be a good resource on that subject). It’s still rough, and I’m having to bone up on some Rails techniques I’ve been ignoring/avoiding to make it work the way it should. I’ve gone out of my way to take as much of a plugins-first approach–if someone else has written great code, why do I need to duplicate?–and thus have been inspired greatly by Jim Neath’s excellent blog. [...]


Leave a Reply

You must be logged in to post a comment.

Jim Neath is a 24 year old Ruby on Rails developer from Manchester, UK. Contact Jim Neath

    follow me on Twitter
    Recommend Me

    Categories

    Stalk Me