Multiple database support for ExtendedDocument.

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
This commit is contained in:
Brian Candler 2009-03-27 11:27:37 +00:00
parent f9278a4ca6
commit ec7848b783
7 changed files with 158 additions and 55 deletions

View file

@ -57,6 +57,13 @@ describe CouchRest::Design do
res = @des.view :by_name
res["rows"][0]["key"].should == "x"
end
it "should be queryable on specified database" do
@des.name = "mydesign"
@des.save
@des.database = nil
res = @des.view_on @db, :by_name
res["rows"][0]["key"].should == "x"
end
end
describe "from a saved document" do