Thoughts, links, pictures on music, food, wine, film, tech etc.


I wrote this:

Playing with CouchDB over the last few months

I've had such a good amount of time with CouchDB over the last few months. I first read about CouchDB when I was back in college on Tobias Luetke's blog. It sounded awesome, but that was about that. At the time, it was quite complicated to get up and running, at least too complicated for me.

Then last year I met Jan Lehnardt and the game changed a little for me. I knew someone connected directly with the project. It became exciting for me. Jan got me up and running with a masterclass in CouchDB at RailsConf Europe last year. My appetite was squarely whetted.

My first foray into CouchDB was a little experiment called "Couchy". Couchy uses a TemplateMap class to parse fields out of HTML and create a schema out of them. It was a fun little project and got me up and running with the basic concepts.

It was a while before I got to try anything else, but in the meantime, Chris Anderson had published CouchRest::Model, which was very interesting, because it attempted to create more ActiveRecord-like models out of CouchDB, including dynamic views. It was full of smart stuff.

I got my hands dirty with CouchRest::Model building the first iteration of this little tumble log. I wanted a dynamic data store so that I could post any kind of content - a post, a quote, a link whatever, but I wanted to add to these easily in the future. Not like create a new database field or fill out some crazy schematic. Like just add a new form and I'd have a new post type.

I got quite far with CouchRest::Model, but then a cascade of issues hit me. What about pagination? What about attachments? What about search. All of these things have been solved really well with will_paginate, Paperclip, ThinkingSphinx. There had to be another way.

Today, in about 20 minutes, I was able to take the cool schema-lessness of this little tumble-log and hook it into a couple of ActiveRecord models that I'll be able to use with the above plugins and ActiveRecord finders. I used "Stuffing" a little plugin I wrote to do just that. Stuffing is the subject of my next post.

Made by Paul Campbell. paul@rushedsunlight.com. Twitter. Github.