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