Method: CouchObject::Document#to_json
- Defined in:
- lib/couch_object/document.rb
#to_json(extra = {}) ⇒ Object
Converts the Document to a JSON representation of its attributes
69 70 71 72 73 74 75 76 |
# File 'lib/couch_object/document.rb', line 69 def to_json(extra={}) if id.nil? opts = {}.merge(extra) else opts = {"_id" => id}.merge(extra) end attributes.merge(opts).to_json end |