Make CouchDB Peepcode work with current version of couchrest

Posted on February 23, 2009

Following along with the couchdb peepcode, I received the following error:

MissingSourceFile (no such file to load -- couchrest/helper/file_manager):
    /app/models/basic_model.rb:43:in `db'

The reason for the error is that the FileManager class is no longer a part of the couchrest gem. It's functionality is being pushed out to a stand alone script called couchapp which manages putting a directory structure into a design doc. Although there is a ruby gem for couchapp on github, it is in the process of getting left behind. The best version of couchapp is now the python version which can be installed doing a

sudo easy_install couchapp

For now though, I got an error from macports so I have been using the ruby version of couchapp just to be able to move on:

sudo gem install jchris-couchapp

So now there should be a utility couchapp which you can run from the command line. Next, in the self.db method in app/models/basic_model.rb replace

file_manager = CouchRest::FileManager.new(File.basename(full_url_to_database))
file_manager.push_views(File.join(Rails.root, "db", "views"))
with
system("couchapp push #{full_url_to_database}")
and continue following along with the peepcode.

Comments
  1. Geoffrey GrosenbachFebruary 23, 2009 @ 06:58 PM
    Thanks for the fix. You may also be able to use my fork of CouchRest from the time of the screencast: http://github.com/topfunky/couchrest/tree/master Or, sudo gem install topfunky-couchrest (Assuming GitHub is in your gem sources). I'll update the screencast to mention this.