Showing posts from December, 2008

CouchDB Ruby Libraries

This is a quick list of CouchDB Ruby libraries. Need to connect Ruby to CouchDB? Try one of these! CouchRest - hosted at GitHub, this library by Chris Anderson (jchris) , has a low level component and a high level component. RelaxDB - also hosted at GitHub, this library provides a base class that your models will extend (similar to the high level component provided by CouchRest.) RelaxDB adds pagination support as well as has_many and belongs_to relationship support. CouchObject - this library is unique because it is implemented as a module, to be included in your model class. This library also has both low level and high level components. Basic Model - from topfunky, this library was featured in the PeepCode CouchDB episode . Your model classes extend BasicModel. ActiveCouch - tries to look like ActiveRecord. Supporting a simple find method to query views. Views are defined as Ruby classes, and loaded via rake tasks. CouchFoo - attempts to replication ActiveR

Reasons Why CouchDB Is Exciting

I've been playing with CouchDB lately, and having a good time getting out of the relational database mindset. I'm not against relational databases, but I do think the time has come to stop thinking they are the only way to store and process data. There are a few reasons why I think CouchDB is exciting. Arbitrary JSON document storage. I like this feature not so much because I'm not required to design a rigid schema, but because it implies that I can store arbitrarily complex and deeply nested data structures. This clears the way for easily storing an object graph without the pains of going through the pains of decomposing into a relational schema. Incremental view rebuilds. This is a killer feature for me, because it implies that a small change in the data does not invalidate the entire view. Keys can be complex objects. In other words, you can now use an array or hash as a key in a view. For example, a key can be [2008, 01, 12] which represents a date. N

Multi Model Forms With Rails

Ruby on Rails still doesn't have a good story to tell with regard to multi-model forms. Multi-model forms are HTML forms that have fields from more than one model, which the user edits and submits as one. Rails should take this single collection of fields, split it up into multiple models, and create, edit, or delete as necessary. Unfortunately, this still requires quite a bit of work. I've collected a set of links that may help those that are new handle multiple models in HTML forms with Rails. None of these are the "official" answer to this complex question. However, it appears that Rails core will one day have an out-of-the-box solution to this. Read on. Ryan Bates, of Railscasts fame, has probably the best known solution to this problem. He suggests Complex Forms Part 1 , Complex Forms Part 2 , and Complex Forms Part 3 . However, as even he mentions, it doesn't work with Rails 2. Refer to these screencasts, and their sometimes useful comments, as

Force HTTP GET for Ext JS DataGrid and Store and JsonReader

I work with ExtJS a lot, and have had great luck with it. We use the layouts, DataGrid, and most of the included widgets. One thing that has always struck me as odd is the Store (the class responsible for fetching and exposing the data) defaults to a HTTP POST when retrieving data. I think that any retrieval of data from an HTTP end point should be GET, to take advantage of caching and the simple fact that the operation is idempotent. If you want to force a HTTP GET method to be used when retrieving data with an Ext JS Store (for instance, when retrieving JSON data), here's the Javascript code: var proxy = new{ url: '/foos.json', method: 'GET' }); var store = new{ remoteSort: true, proxy: proxy, sortInfo: {field: 'id', direction:'desc'}, reader: new{ fields: [{name:'id', type:'number'}, {name:"created_at", type: 'date', dateFormat: Date.patterns.XmlSc

Blog Now Hosted At, Redirects All Setup, Crossing Fingers

I moved this blog to which is now hosted on  I just didn't feel the need to continue to host my own installation of, which was always out of date anyway.  Plus, everything else in my life is either rented or a service, so why not my blog? I told Apache to redirect everything from that is NOT a file over to  Here's how I did it: RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)${REQUEST_URI} [R=permanent,QSA,L] Hopefully your feed reader respects the redirects! And thanks for following!