Examples:
db = CouchRest::Database.new(...)
articles = Article.on(db)
articles.all { ... }
articles.by_title { ... }
u = articles.get("someid")
u = articles.new(:title => "I like plankton")
u.save # saved on the correct database
New optional parameters are available to select the database:
Mixins::DocumentQueries
* get <id>, <db>
* all :database => <db>
* first :database => <db>
Mixins::Views
* view <name>, :database => <db>
* all_design_doc_versions <db>
* cleanup_design_docs! <db>
Mixins::DesignDoc
* refresh_design_doc now only updates the design_doc _id and removes _rev
* call save_design_doc to save and update the design_doc
* call save_design_doc_on <db> to save the design doc on a given
database without modifying the model's design_doc object
Design (core/design.rb)
* new method view_on <db>, ...
Bug fixes:
* design_doc_slug in mixins/design_doc.rb was using an empty document
to calculate the slug each time
* method_missing in core/extended_document.rb now passes a block through
property :casted_attribute, :cast_as => 'WithCastedModelMixin'
A casted attribute now knows about its parent. (#casted_by to retrieve the parent's object)
* 'master' of git://github.com/jchris/couchrest:
all specs pass; refined attachment api
add mattetti's 5aebd53a93
fix rebase end balance
Started on the ExtendedDocument class with features moved to mixins.
Started on the ExtendedDocument class with features moved to mixins.
updated readme file
Started the refactoring work on couchrest.
added some monkey patches to improve the http connection speed. (by keeping the http connection open)
slight change of API, CR::Document now uses <action>_doc instead of <action>, also added #create! and #recreate! to Document instances
Added attachment methods to CouchRest::Document: #put_attachment, #fetch_attachment and #delete_attachment. Note you can overwrite exisitng attachments with #put_attachment.
- Added Database#delete_attachment, for removing them directly
documentation for Document#copy and #move, copied from Database
database replication methods, no conflict resolution provided
* A server can have multiple defined available databases set to be used by documents (think DM repos)
* A server can have a default database so documents can easily share the same db connection
* Let a document class have a default database to use
* Give access to a document uri
* extracted some of the document features to a mixin
- Modified Database#fetch_attachment to take a doc as its first argument +as well as+ a docid, to be consistent with the other attachment methods.
- Refactored the attachment uri generation used by #fetch_attachment, #put_attachment, and #delete_attachment to a common private method, #uri_for_attachment
* A server can have multiple defined available databases set to be used by documents (think DM repos)
* A server can have a default database so documents can easily share the same db connection
* Let a document class have a default database to use
* Give access to a document uri
* extracted some of the document features to a mixin