Recommendable is an engine for Rails 3 applications to quickly add the ability for your users to Like/Dislike items and receive recommendations for new items. It uses Redis to store your recommendations and keep them sorted by how good the recommendation is.
Add the following to your Rails application's
gem "recommendable", :git => "git://github.com/davidcelis/recommendable"
After bundling, run the installation generator:
$ rails g recommendable:install
config/initializers/recommendable.rb for options on configuring your Redis connection. After a user likes or dislikes something new, they are placed in a Resque queue to have their recommendation updated. Start up resque like so:
$ QUEUE=recommendable rake environment resque:work
You can run this command multiple times if you wish to start more than one worker. For more options on this task, head over to defunkt/resque.
In your Rails model that will be receiving recommendations:
class User < ActiveRecord::Base recommends :movies, :shows, :other_things # ... end
That's it! Please note, however, that you may only do this in one model at this time.
Recommendable requires Redis to deliver recommendations. The collaborative filtering logic is based almost entirely on set math, and Redis is blazing fast for this. NOTE: Your redis database MUST be persistent.
For Mac OS X users, homebrew is by far the easiest way to install Redis.
$ brew install redis
Resque (which is also a dependency of recommendable) includes Rake tasks that will install and run Redis for you:
$ git clone git://github.com/defunkt/resque.git $ cd resque $ rake redis:install dtach:install $ rake redis:start
Redis will now be running on localhost:6379. After a second, you can hit
ctrl-\ to detach and keep Redis running in the background.
Contributing to recommendable
Once you've made your great commits:
- Fork recommendable
- Create a feature branch
- Write your code (and tests please)
- Push to your branch's origin
- Create a Pull Request from your branch
- That's it!
git clone git://github.com/davidcelis/recommendable.git
- Home: http://github.com/davidcelis/recommendable
- Docs: http://rubydoc.info/gems/recommendable/frames
- Bugs: http://github.com/davidcelis/recommendable/issues
- Gems: http://rubygems.org/gems/recommendable
Copyright © 2012 David Celis. See LICENSE.txt for further details.