Tuesday, March 27th, 2007


Category: Rails, Showcase

CrowdRules is a Ruby on Rails website that lets the community rank videos.

Igal Koshevoy told us about the new site that is in beta:

CrowdRules is a “crowd-powered content recommendation engine”. We use Ajax in a few, carefully-selected parts of our application to improve the user experience. Our application is written using Ruby on Rails and implements Ajax features using RJS templates and the Prototype library. These tools are a pleasure to work with and make it easy to get things done right, so we highly recommend them.

Here are some of the highlights of our use of Ajax:

Votes and violations: CrowdRules strives to provide a honest voting environment for our users. The application prevents common abuses of online voting systems by encrypting votes using one-time tokens. Ruby on Rails lets us elegantly bind the voting UI with the logic that manages tokens and thus votes. In the past, using AJAX meant struggling with parameter parsing and writing screenfuls of JavaScript that often duplicated application logic or required a bunch of stubs to interact with the underlying application. But Rails lets us implement the voting features without any of that fuss. Using Ajaxified Rails helpers, like “link_to_remote”, the user clicks are cleanly routed to our controller for processing and then onto an RJS template that generates JavaScript to update the UI. The resulting code is surprisingly easy to read and maintain. The same pattern is used to let users report violations such as “this video doesn’t play”.

Video creation: CrowdRules tries to make it easy for users to add exciting content. We use AJAX to save users from having to fill out long forms that specify the video’s name, embed HTML and such. Instead, our users simply paste a video’s URL into a form that invokes an Ajax-enabled action that parses it, identifies the media provider (e.g. YouTube) and uses that provider’s API to return a pre-populated form automagically. The form only displays fields the user needs to fill out, which vary depending on whether the video was found, was already in our system, what provider serves it, etc. When the user submits the form, all fields are validated against rules unique to that state and this prevents broken submissions by making sure that the embed HTML matches an actual video at the media provider, that the entry has a title and so forth. The combination of AJAX bindings, Prototype, and Rails features like ActiveRecord validations let us make this friendly form quickly.

Unit tests: It’s important for Crowdrules that our application works correctly, but this can be a challenge for a rapidly-growing application that we’re always adding features to and even a small change can inadvertently break the system. To address this, we’ve built an automated test suite that validates almost all of our application’s features. AJAX is tricky to test, but we’ve made the AJAXified actions fall back to traditional behavior when JavaScript isn’t available, such as during tests. For example, one test submits a valid vote to an AJAX-enabled action via a faux web browser and then confirms that all the proper database entries were made — and we also have another battery of tests that cast all sorts of invalid votes and make sure that none of them make it into the database. Being able to validate the logic invoked by the AJAX actions by applying these approaches has made development much easier and less risky.


Posted by Dion Almaer at 4:11 am

3.6 rating from 26 votes


Comments feed TrackBack URI

Two questions:

I know that its a server-side language, but really – what’s the big deal about Ruby, or Ruby on Rails? It has a rather vocal fanbase, and it is associated with some of the best-designed programming-centric websites (Ruby, RoR, RailConf, Engine Yard, FiveRuns, etc.) out there (compare to the PHP or Java websites)

Also, why is it that I just happen to hear “Ruby” and “Mac” in the same sentence alot? It’s as if most Ruby programmers are Mac users or something….

Comment by Rayne Van-Dunem — March 27, 2007

Boring… Old concept….They just link YouTube videos and people rate them… which YouTube already does. Whats the point.

Horrible site design as well.

Comment by Shawn — March 27, 2007

Dear Shawn,

Thanks for taking the time to visit the site and write a comment.

While everyone has their own ideas of our site design – some love it, some hate it, most are neutral – I’m sorry that you didn’t take the time to use CrowdRules and find out what we actually do. There’s a lot more there than you described.

CrowdRules is a contest-based system that allows people to do question and answers with videos. Many people using our site are creating their own video questions and responses. CrowdRules primarily allows businesses and individuals to do self-serve media research, which is a $1b service business ripe for disruption by a free site such as ours. For movie studios, record labels, and anyone else running contests one-off, this is a godsend. No-one else has provided this service except bix, and bix’s voting can easily be gamed.

CrowdRules may at first glance appear – to someone looking at just one or two pages – to only be about linking YouTube videos and rating them. Perhaps that’s our fault for not making things perfectly clear about what you can do on the site. And I agree with you that such a site would truly be a boring and old concept, not to mention patently absurd, and a waste of tens of thousands of lines of RoR code. That’s why what you described is the tip of the iceberg for our site. We’re adults. We wouldn’t waste our time. We thought this out.

We are taking advantage of the fact that our users can park their videos at YouTube, or Veoh, or Brightcove, or any other video sharing site, then link them to us. Using YouTube is a convenience for our members, but this is not about rating YouTube videos. Even in its simplest form, people are grabbing dozens of videos from other sites and using their friends to create a collaborative video ranking list, another service that no one else provides. And YouTube ratings are among the most gamed ratings on the web. Their rating system is completely useless.

So, the fact that you didn’t take the time to find out more about the site most likely means that it’s not for you. That’s okay. But there are people who get it and are finding it quite useful.


Comment by David — March 27, 2007

Shawn obviously didn’t look at the site. There’s enormous attention paid to making the voting or rating actually mean something, which You Tube does not do – as proven by the constant gaming of YouTube’s voting system.

I have to think there’s value in an honest voting system.

Comment by Tom — March 28, 2007

* Dion: Thank you for publishing my little article.

* Shawn: Sorry that the site didn’t make a good first impression on you. I hope you and others look around more, because there’s more to it than you noticed at first glance.

* Rayne: Good questions:

– Why Ruby on Rails? Different tools fit different needs. PHP lets me make a quick site, but is a pain once it gets complicated. Java lets me write enterprise-grade applications, but requires an immense amount of effort to build and even more to change. Ruby on Rails is a valuable middle ground between these that let the small CrowdRules development team quickly build a sophisticated, maintainable application that we could rapidly adapt to new requirements. Some call this “cool”, while others describe it as a “smart business decision”. I recommend you spend a weekend skimming through Dave Thomas’ “Agile Web Development with Rails” book to see what the big deal is all about.

– Why Macs? Not sure. CrowdRules was built and deployed on Linux. Using Linux gave us a productive desktop environment and solid server platform. It included many excellent packages that sped up development, and made it possible to custom-built a high-availability cluster and put into production within weeks, rather than months. Its flexibility also let us automate all the setup and maintenance of systems, applications and dependences. In a few minutes, these scripts can install a new developer desktop, create a virtual machine, or build a new cluster on servers thousands of miles away, and then update these with a single command. The combination of these features make Linux hard to beat.

Comment by Igal Koshevoy — March 28, 2007

I just threw up in my mouth. I’m sorry but thats an awful site. Youtube already has user rating. Who just wasted their time on that project?

Comment by Ryan Wilke — April 2, 2007


Thanks for your colorful comment. You’re so observant: YouTube does indeed have ratings! In fact, every site on the web has similar rating systems. But behind the scenes, in the real world of business, people actually care about the quality of those ratings. It’s called media research, and it’s a $1b service business. No other site except CrowdRules deals effectively with this issue. That’s why we built CrowdRules.

Comment by David — April 4, 2007

There’s enormous attention paid to making the voting or rating actually mean something, which You Tube does not do – as proven by the constant gaming of YouTube’s voting system.

Comment by Resume — September 12, 2007

seems to me like another version of the Pligg template.

Comment by stevenjmyu — May 19, 2009

Leave a comment

You must be logged in to post a comment.