Quickly Add CouchDB to Existing Rails Models with Stuffing
Paul Campbell, a partner over at Contrast, has released a new plugin called Stuffing that allows you to add CouchDB functionality to your Rails application's existing ActiveRecord models without you having to quit the world of ActiveRecord (though if you want something that's ActiveRecord-like but CouchDB all the way, check out CouchFoo!)
To use stuffing, just install the Stuffing plugin (instructions here), then use the stuffing directive in your model and you're good to go:
class Post < ActiveRecord::Base
stuffing
end
In addition to persisting your model's attributes to CouchDB, Stuffing also lets you create your own attributes for persisting additional attributes to and from CouchDB:
@post = Post.last
@post.stuffing_tags = "rails, plugin, couchdb"
@post.stuffing_tags # => "rails, plugin, couchdb"
Stuffing is great for people who are new to CouchDB but don't want to leave the world of ActiveRecord. It's also great where you might be doing some prototyping on an application and you want to add additional attributes to your models as a test, before committing to writing any tests and code. The Stuffing plugin is available from GitHub.
You might also appreciate this short video introduction to Stuffing that Paul has produced.
This post was written by Matthew Lang, an ERP developer with a keen interest in Ruby and Rails programming.
February 26th, 2009 at 9:11 pm
Cool! Looking for something similar.
February 26th, 2009 at 9:32 pm
Thanks for the writeup Matthew. Another Couch only option is: Couch Potato
February 26th, 2009 at 11:21 pm
Thanks for the link to Couch Potato, Paul!