Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Snow Dogs R Us a rails based social networking site

Posted by Jim Morris on Thu May 31 12:59:01 -0700 2007

I have started a new project for myself and a few friends, Snow Dogs R Us. This site just went live! (on 6/20/2007). It is a full blown Web2.0 (insert other buzz words here), social networking site for Snow Dogs and their (human) parents.

It is certainly a challenging project and taking much longer than I anticipated.

The basic features include sign-up, forgot password, login, optional profiles for the user and their snow dogs, and all the usual stuff there.

The advanced features include linking to friends for both the humans and the pets, so the humans can link to other human friends, and the pets can link to their friends too (Ala MySpace and Facebook etc). I want to eventually have a LinkedIn type of network as well, so you can see how many degrees you are away from other people, this is a real challenge to do in Rails, and I will probably actually write a Java engine to do that, as it is pretty compute and memory intensive. (Its not really an essential feature of the site, but I like technical challenges).

Of course there will be the ability to comment on everything, rate everything and tag everything, and there has to be the obligatory Mashup with Flickr and YouTube for all those cute photos and videos of our pets. (What other Web2.0 feature have I missed?).

Luckily the Rails community has already made available a lot of plugins we can use. I currently use these plugins...

  • active_scaffold - for the admin interface
  • acts_as_taggable_on_steroids - for the tagging
  • haml - For all my HTML structure needs
  • test_spec_on_rails - a better way to test
  • acts_as_commentable - pretty basic comments
  • cssformbuilder - highly customized, I need to make my mods available
  • restful_authentication - for authentication, I added the forgot password hack slightly modified
  • transactional_migrations - Ideal for Postgresql
  • acts_as_rated - I started using acts as rateable but switched
  • calendar_date_select - for inputting dates
  • sexy_migrations - Makes migrations so much easier
  • will_paginate - For paginating those pages
  • attachment_fu - For uploading the pictures (and FreeImage and ImageScience for scaling them)

I looked at has_many_friends but it was so close to what I had already done I just decided to keep my version, plus I want to add that degrees of freedom stuff later on.

There have been many posts about the friendships links in Rails, some decided to simply have a HABTM with two entries to make the link symmetric, I don't like wasting space so my solution uses a single entry for their friendship, and some SQL to find friends regardless of whether they invited you or you invited them. I'll blog about that later when I optimize it a bit more, as friendship links can grow exponentially I think it is prime candidate for optimization both in the amount of space is uses in the database and for database access, and simple has_many :through construct work but in this case will be very inefficient.

Another feature is the ability to create events and invite everyone or just your friends (think evite for dogs), this is relatively simple except keeping track of the invitations and who accepted etc. I also link to Places, because an event is usually at a place, and of course the place needs to have directions, so a link to Google maps is in order there. Of course a place needs to be taggable and commentable and rateable.

Lastly is the ability to make recommendations. In the dog community we share advice on Vets, food, dog friendly places to visit like restaurants, parks, beaches etc. These all need to be taggable, rateable and commentable and of course searchable. I've gone back and forth on how to implement that, right now it is a simple table called inputs (user input), which is taggable, commentable, and rateable. It relies on people tagging properly, IE tag with restaurant for dog friendly restaurants, and vet for vet recommendations etc. I originally had a belongs_to input_type with predefined categories, but decided to trust the user and just allow tags. We'll see how that works. Maybe the tag input field needs to auto_complete with a list of current tags so people are more inclined to tag with already used tags.

My biggest problem is the web design or look and feel, I am a programmer not a designer, so I can solve the complex programming issues and implement all the functionality, but I get really stuck when I try to figure out how to present that information. If this was a "for pay" project I would hire a web designer, but it is definitely a not-for-profit project so I can't afford that, so I'll struggle with the design.

I'll post more entries on some of my solutions to the technical problems as I go.

A few things I have learned, is to use piston for managing plugins, and avoid alpha plugins :)

Posted in Rails  |  Tags rails,social,networking,web2.0  |  9 comments


  1. http://theplana.wordpress.com said on Thu May 31 13:59:11 -0700 2007
    Hi, im starting a similar project, and this post look useful for me. Also i was looking for a complete Social network example/OS project in ruby. Do you know someone?
  2. wolfmanjm said on Thu May 31 14:24:47 -0700 2007
    I have seen a couple of books out on the subject...



  3. Daniel said on Fri Jul 06 09:21:36 -0700 2007
    Nice post! Especially the list of plugins, has been really helpful to me!
  4. john said on Tue Jul 10 07:40:30 -0700 2007
    how did you put active_scaffold and attachment_fu to work together?
  5. wolfmanjm said on Tue Jul 10 10:41:06 -0700 2007
    I only use A/S for the admin interface, so its not an issue as I am not uploading anything via the admin I/F. The public I/F is not using A/S at all.
  6. Attila said on Fri Aug 17 04:41:47 -0700 2007
    My project uses many of the same plugins, but I'm stuck trying to use acts_as_rated currently. I've a lot of functionality working at this stage, at it for about 4 months now, but going is very slow. I've also yet to actually use the acts_as_taggable_on_steroids ... but that's next weeks battle ;0). I'm getting an error ..
    "ActiveRecord::Acts::Rated::RateError (the rater object must be the one used when defining acts_as_rated (or a descendent of it). other objects are not acceptable):"
    Don't suppose you've come across the problem ?. I'm not going to post code snippets to pollute things here, but if you had a minute or two I could do with someone who's "been there" to glance at it.
    Email me if you pity a fellow Ruby Newby ... please :0)
    Thanks in Advance,
  7. Attila said on Fri Aug 17 09:45:45 -0700 2007
    OK ... figured it out. My problem was not understanding that the 'rater' had to be infact a 'User' object. I suppose the examples confused me.
  8. Andreas Kviby said on Sun Aug 19 17:17:50 -0700 2007
    Can you please post or past at pastie the code you use together with act as taggable on steroids to get the clouds on your startpage?
  9. wolfmanjm said on Sun Aug 19 17:34:30 -0700 2007
    I posted a blog entry with all the info on how to do that [here](http://blog.wolfman.com/articles/2007/06/23/developing-a-social-networking-site-part-3-tag-cloud)

(leave email »)