Skip to content

Commit

Permalink
Added docs for new way of using [] to create prefilled unsaved documents
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenna Fox committed May 3, 2012
1 parent 6d08e0d commit b650265
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/chill.rb
Expand Up @@ -98,8 +98,21 @@ def design name
end

# Loads or creates a document with a specified _id. If no _id is specified
# a new blank document is created which will be assigned a fresh UUID as
# it's _id when saved unless you specify one before committing it.
# a new blank document is created which will be assigned a fresh UUID when
# unless you specify one before committing it. You can optionally provide values
# for a new document as a hash argument. Note that documents created in this
# way are not saved to the database unless you use ChillDB::Document#commit!
# or pass them to #commit!
#
# Example:
# KittensApp['fredrick']
# #=> {"_id"=>"cheezly", "color"=>"invisible", "dislikes"=>["silly business"], ... }
# KittensApp[['fredrick', 'cheezly']]
# #=> [{"_id"=>"fredrick", ... }, {"_id"=>"cheezly", ... }]
# KittensApp[]
# #=> {}
# KittensApp[billy: 'cool', margret: 'not cool']
# #=> {"billy"=>"cool", "margret"=>"not cool", "_id"=>"df2c3d11-d50a-4db9-8f57-04fd4d511ded"}
#
# Returns a ChillDB::Document
def document id = false
Expand Down

0 comments on commit b650265

Please sign in to comment.