Couchrest Model 1.2.0.beta

Skip to first unread message

Samuel Lown

Jun 8, 2012, 4:33:28 PM6/8/12

Its been a while, but I've finally made the time to cook up a new version of Couchrest Model: 1.2.0.beta.

Its a major release as there are a few breaking changes. Unless you've been using the "design blocks" to create your views, you will no longer be able to use this version. Allow me to explain.

The design doc handling has been completely refactored so that it works in a much more object-orientated fashion and is far easier to understand. Design blocks (or definitions) can now be properly inherited by submodules and models can have multiple design docs. The side effect of this is that all the old `view_by`, `view`, `has_view?` and missing methods seemed pointless to continue maintaining. Some people are likely to be set back by this change, but I hope you'll try the new approach and see that it is easier and less confusing for newbies.

Another important difference is that if a view is not described in the design block, you will not be able to access it from couchrest model! Fortunately, there are ways to get around this, for example:

    design do
      view :by_name, :reduce => true

The new `disable_auto_update` ensures this design block is never written to or requested from the database. This means that CouchRest is unable to see if a view exists, or more importantly if it has a reduce method. Setting `:reduce => true` in the view definition gets around this problem and prevents those annoying 400 errors on queries that need the "reduce=false" parameter. 

I've only just started working on updating the docs, but some more details are available here:

Aside from the design blocks, there are also a few other fixes like Rails 3.2 support and Time now includes fractions (super import for indexes). 

Please give it a try and let me know how it goes!


Peter Williams

Jun 11, 2012, 11:42:15 AM6/11/12
These changes look great. I am looking forward to taking advantage of them.

Given the incompatible improvements introduced in the API wouldn't a
version of 2.0.0.beta be more appropriate?[1] That major version bump
will make it clear that some of the consumer facing API has changed in
an incompatible way. It will also mean that people specifying
dependency with the `~>` operator will not be automatically upgraded
to this new and improved, but incompatible, version of Couchrest Model
once it exits beta.


> --
> You received this message because you are subscribed to the Google Groups
> "CouchRest" group.
> To post to this group, send email to
> To unsubscribe from this group, send email to
> For more options, visit this group at

Samuel Lown

Jun 12, 2012, 6:20:53 AM6/12/12

Okay, reading the semver doc it seems reasonable to to do a major release. I'll package it next time as 2.0.0.beta.

I've also started adding Migration support to the new design docs so its really easy to update the design doc, generate the views, and copy the design doc over the original without any downtime. When I have that properly tested we'll be closer to a final release.


Reply all
Reply to author
0 new messages