Storing images in a noSQL database might be a good approach for many applications, and it can alleviate many replication and scalability issues when it comes to images and by extension other binary files.

Riak can store any kind of data, including binary. Whatever you can turn into an Erlang tuple can be stored, without the 4MB document size limitation of MongoDB or the “attachment”-model of CouchDB.

First, ripple has to be installed, the “official” Ruby driver for Riak:

sudo gem install ripple

Then require it in environment.rb of your Rails app:

config.gem ‘ripple’

This gem will pull some dependencies, namely activesupport-3.x and also activemodel. To continue working with Rails 2.3.5 without these beta gems, first uninstall them:

sudo gem uninstall activesupport –version ’3.0.0.beta3′

sudo gem uninstall activemodel

You will now get

no such file to load — active_support/i18n

when trying to start the server.

Sean is in the process of splitting the ripple gem into the ‘riak’ and ‘ripple’ (OM) parts to make the ‘riak’ part compatible with Rails 2.3.5., but for now you could either unpack the gem into vendor/gems (Google is your friend), or patch the offending file (your path may be different):

/usr/local/lib/ruby/gems/1.8/gems/ripple-0.6.1/lib/riak/i18n.rb:14

By simply changing

require ‘active_support/i18n’

to

require ‘i18n’

Now script/console or script/server will still give a bunch of warnings but the app should start.