add method 'last' to simplify queries

This commit is contained in:
Lucas Renan 2010-12-31 18:59:57 -02:00
parent 92a10dbfc9
commit 3a1b271558
4 changed files with 34 additions and 0 deletions

View file

@ -75,6 +75,12 @@ module CouchRest
doc
end
def last(opts = {})
doc = @klass.last({:database => @database}.merge(opts))
doc.database = @database if doc && doc.respond_to?(:database)
doc
end
def get(id)
doc = @klass.get(id, @database)
doc.database = @database if doc && doc.respond_to?(:database)