Wynn Netherland changelog.com/posts

Recommendable - Add simple binary voting to your Rails app

David Celis hates five star ratings systems:

Binary voting habits are most certainly not an odd phenomenon. People tend to vote in only two different ways. Some folks give either 1 star or 5 stars. Some people fluctuate between 3 and 4 stars. There are always outliers, but what it comes down to is this: a person’s binary votes indicate, in general, a dislike or like of what they’re voting on.

For this reason, David has created Recommendable, a recommendation engine for Rails 3.1 and 3.2 based on Redis. With just a bit of DSL magic in your model, your users can now like or dislike other types in your system:

class User < ActiveRecord::Base
  recommends :movies, :shows, :other_things

  # ...
end

# like a movie
current_user.like Movie.first

# dislike a movie
current_user.dislike Movie.last

Recommendable also provides the usual Ron Burgundy-approved interrogative methods:

current_user.likes? @movie
current_user.dislikes? @movie

There are also a number of helpful methods for ignoring items, getting shared likes between two users, and more. Check the README for setup and advanced usage.

Also, in case you missed it, last month we covered Recommendify, a Ruby and Redis powered recommendation engine from Paul Asmuth if you need full blown recommendations instead of binary voting.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00