added the Model.all view
This commit is contained in:
parent
355d408730
commit
26059f63f2
|
@ -93,6 +93,10 @@ module CouchRest
|
||||||
end
|
end
|
||||||
|
|
||||||
def all opts = {}
|
def all opts = {}
|
||||||
|
self.generated_design_doc ||= default_design_doc
|
||||||
|
unless design_doc_fresh
|
||||||
|
refresh_design_doc
|
||||||
|
end
|
||||||
view_name = "#{design_doc_slug}/all"
|
view_name = "#{design_doc_slug}/all"
|
||||||
raw = opts.delete(:raw)
|
raw = opts.delete(:raw)
|
||||||
view = fetch_view(view_name, opts)
|
view = fetch_view(view_name, opts)
|
||||||
|
|
|
@ -187,12 +187,11 @@ describe CouchRest::Model do
|
||||||
end
|
end
|
||||||
it "should make the design doc" do
|
it "should make the design doc" do
|
||||||
WithTemplate.all
|
WithTemplate.all
|
||||||
puts d = WithTemplate.design_doc.to_json
|
d = WithTemplate.design_doc
|
||||||
d.should == 'xs'
|
d['views']['all']['map'].should include('WithTemplate')
|
||||||
end
|
end
|
||||||
it "should find all" do
|
it "should find all" do
|
||||||
rs = WithTemplate.all :raw => true
|
rs = WithTemplate.all
|
||||||
rs.should == 'x'
|
|
||||||
rs.length.should == 4
|
rs.length.should == 4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue