Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (41 sloc) 2.616 kb
* Update the get method to take an existing doc, and reload it. Use ETags
* At the top level retrieved, look for a RubyType field, and cast
* Model Thoughts:
* Everything extends Dash.
* vague AR methods (Create, save, hooks)
* When a new Document is instantiated, it's RubyClass property is set to its class
* It's converted to JSON just by calling to_json on the parent 'document' class
* When it's parsed in, the overridden/delegated get method checks the type of the
parent object, and in instantiates it, passing the JSON hash in as a constuctor.
* The super constructor then loops the sub items, instantiating when it see's a
RubyClass object, otherwise just setting the value.
* There should be a different parent class for Master documents and the sub items.
sub item's don't have save/get methods - only useful when loading from a view.
* Bulk fetch, and maybe bulk update.
* look into "include_docs"
* Bulk fetch for joined documents, use document with keys=[abc, def, ghi] etc
* Bulk fetch, get method checks for array param. If it's an array, POST with keys
* bulk put, save method checks for array param, and bundles into docs array
* Attachments
* Just a put to url/attchment with data attached. Data in as a #read object?
* Design Documents
* Would be great to have a way to include functions into designs. Either via Couch, or embed
* Niceities
* pretty format the JSON dump?
* Model stuff 2
* Have a mixin, that can be called inside something that subclasses Dash.
* when the method is called to set the database on the Dash, look for a design
document with the same name
* If it exists, map methods on the _class_ for .viewname that invoke the view,
and .listname.viewname that invoke the view from the list. these take a
params hash, and pass these in as URL params.
* when these view methods are called, iterate the result tree, and if they have a
couchdoc class and that class exists, instantiate it with the contents.
* when calling the get method on the class, do the object matching as well
* the tree setting for sub items is up to the object to do in its' constructor
* provide a convenience 'cast' method to help with this?
* The get method should return an array by default, but if a :limit=1 param set,
return a single object.
* Check that the mash constructor uses the passed in object, rather than copying.
* Handle include_docs?=true better - maybe check params, if this this set make sure
the document object is loaded from ['doc'], and that ['value'] goes somewhere else
Jump to Line
Something went wrong with that request. Please try again.