add method 'last' to simplify queries
This commit is contained in:
parent
92a10dbfc9
commit
3a1b271558
4 changed files with 34 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue