lib/couchpillow/document.rb in couchpillow-0.1 vs lib/couchpillow/document.rb in couchpillow-0.1.1
- old
+ new
@@ -53,22 +53,27 @@
def timestamp!
@data[:updated_at] = Time.now.utc
end
+ # Save this document to the server
def save!
validate
sort!
timestamp!
CouchPillow.db.set @id, @data
end
+ # Delete this document from the server.
+ #
def delete!
CouchPillow.db.delete @id
end
+ # Sort keys on this document.
+ #
def sort!
@data = @data.sort.to_h
end