Couchrest Model 1.2.0.beta

65 views
Skip to first unread message

Samuel Lown

unread,
Jun 8, 2012, 4:33:28 PM6/8/12
to couc...@googlegroups.com
Hi,

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
      disable_auto_update
      view :by_name, :reduce => true
    end

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: http://www.couchrest.info/model/view_objects.html

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!

sam

Peter Williams

unread,
Jun 11, 2012, 11:42:15 AM6/11/12
to couc...@googlegroups.com
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.

[1]: http://semver.org/

Peter
> --
> You received this message because you are subscribed to the Google Groups
> "CouchRest" group.
> To post to this group, send email to couc...@googlegroups.com.
> To unsubscribe from this group, send email to
> couchrest+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/couchrest?hl=en.

Samuel Lown

unread,
Jun 12, 2012, 6:20:53 AM6/12/12
to couc...@googlegroups.com

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.

Cheers,
sam

Reply all
Reply to author
Forward
0 new messages