Differences between revisions 14 and 15
Revision 14 as of 2011-08-26 05:17:41
Size: 2971
Editor: 115
Revision 15 as of 2018-04-09 17:26:20
Size: 0
Editor: JoanTouzet
Comment: Moved to https://cwiki.apache.org/confluence/display/COUCHDB/Ruby+Client
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
For a simple Ruby wrapper around CouchDB's RESTful API, see http://github.com/couchrest/couchrest, which keeps you fairly close the metal and is used as a driver in many other CouchDB ruby libraries. For a more Rails-like experience check out couchrest's companion library [[http://github.com/couchrest/couchrest_model|CouchRest Model]] which uses [[http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/|ActiveModel]] and includes support for typecasting, validations, basic associations, proxying (dynamically generated databases), and a powerful yet simple DSL for manipulating views and their results.

CouchRest Model can be easily installed in your Rails 3 project's Gemfile:

{{{ gem couchrest_model }}}

or manually:

{{{ gem install couchrest_model }}}

For parallel query execution, try [[http://github.com/atduskgreg/slipcover/tree/master|Slipcover]].

You can get started fairly quickly using [[http://couchobject.rubyforge.org|Couch Object]]

To download the edge version using git, run ''git clone git://gitorious.org/couchobject/mainline.git''

CouchObject gives you an easy way to connect to and work with CouchDB. Its main strengths are that it lets you save and load Ruby objects to and from the database using the CouchObject::Persistable module.

As of version 0.6 it supports has_many, has_one and belongs_to relations, in addition to amongst others time stamps. Please have a look at the [[http://couchobject.rubyforge.org/rdoc/|Rdoc]] for more information.

Alternatively, the [[http://datamapper.org|DataMapper]] Ruby ORM has a CouchDB adapter (just install the ''dm-core'' gem for datamapper and the ''dm-more'' gem for the adapter).

[[http://github.com/paulcarey/relaxdb/wikis|RelaxDB]] offers a similar idiom to !ActiveRecord for persisting objects to CouchDB as is [[https://github.com/langalex/couch_potato|Couch Potato]]

A quick note: If you have any problems like bad_utf8_character_code make sure you use unicode:

require 'jcode'
and use active_support 'chars' method.

[[http://github.com/candlerb/couchtiny|CouchTiny]] is an experimental library inspired by CouchRest but designed to be closer to the metal, with a smaller and simpler code base. It does not have properties or validations.

[[http://github.com/georgepalmer/couch_foo/tree/master|CouchFoo]] is an ActiveRecord-style interface to CouchDB. Basic operations (creating records, finding, and even ''dynamic'' finders) are much the same as with ActiveRecord, but there have been some additions to deal with the differences in CouchDB (such as defining properties to get typing or view definitions). Associations (''has_many'', etc) also work as expected.

[[https://github.com/arunthampi/activecouch|ActiveCouch]] – a ruby on rails experienced library in the spirit of ActiveResource and [[ActiveRecor|ActiveRecord]] for CouchDB.