added count to proxy
This commit is contained in:
parent
413a7602e8
commit
be7cd7442b
2 changed files with 7 additions and 0 deletions
|
@ -59,6 +59,10 @@ module CouchRest
|
|||
@klass.all({:database => @database}.merge(opts), &block)
|
||||
end
|
||||
|
||||
def count(opts = {}, &block)
|
||||
@klass.all({:raw => true, :limit => 0}.merge(opts), &block)['total_rows']
|
||||
end
|
||||
|
||||
def first(opts = {})
|
||||
@klass.first({:database => @database}.merge(opts))
|
||||
end
|
||||
|
|
|
@ -212,6 +212,9 @@ describe "ExtendedDocument views" do
|
|||
rs = @us.all
|
||||
rs.length.should == 4
|
||||
end
|
||||
it "should count" do
|
||||
@us.count.should == 4
|
||||
end
|
||||
it "should make the design doc upon first query" do
|
||||
@us.by_title
|
||||
doc = @us.design_doc
|
||||
|
|
Loading…
Reference in a new issue