Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow hashes with symbol keys for Database#save_doc #73

Closed
wants to merge 1 commit into from

1 participant

@heyLu

Use Document in Database#save_doc to allow non-string hashes as arguments.

So you can write stuff as:

db.save_doc({
_id: "bleh",
whatever: "Is quite awesome",
plus_one: 3
})

And have it accept _id properly.

@heyLu heyLu Use Document in Database#save_doc to allow non-string hashes as argum…
…ents.

So you can write stuff as:

db.save_doc({
	_id: "bleh",
	whatever: "Is quite awesome",
	plus_one: 3
})

And have it accept _id properly.
8a0d889
@heyLu heyLu closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 4, 2011
  1. @heyLu

    Use Document in Database#save_doc to allow non-string hashes as argum…

    heyLu authored
    …ents.
    
    So you can write stuff as:
    
    db.save_doc({
    	_id: "bleh",
    	whatever: "Is quite awesome",
    	plus_one: 3
    })
    
    And have it accept _id properly.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  lib/couchrest/database.rb
View
1  lib/couchrest/database.rb
@@ -112,6 +112,7 @@ def get(id, params = {})
# accept the risk that a small proportion of updates could be lost due to a
# crash."
def save_doc(doc, bulk = false, batch = false)
+ doc = Document.new doc
if doc['_attachments']
doc['_attachments'] = encode_attachments(doc['_attachments'])
end
Something went wrong with that request. Please try again.