fixed a bug with ExtendedDocument not declaring any views and trying to use #all or #first
This commit is contained in:
parent
98fb1d728d
commit
3e6dba7b66
|
@ -16,6 +16,7 @@ module CouchRest
|
|||
def design_doc_slug
|
||||
return design_doc_slug_cache if (design_doc_slug_cache && design_doc_fresh)
|
||||
funcs = []
|
||||
design_doc ||= Design.new(default_design_doc)
|
||||
design_doc['views'].each do |name, view|
|
||||
funcs << "#{name}/#{view['map']}#{view['reduce']}"
|
||||
end
|
||||
|
|
|
@ -129,12 +129,11 @@ module CouchRest
|
|||
private
|
||||
|
||||
def fetch_view_with_docs(name, opts, raw=false, &block)
|
||||
if raw
|
||||
if raw || (opts.has_key?(:include_docs) && opts[:include_docs] == false)
|
||||
fetch_view(name, opts, &block)
|
||||
else
|
||||
begin
|
||||
# auto load mentioned documents unless asked differently (didn't use merge! on a previous line to avoid duping the object)
|
||||
view = fetch_view name, (opts.has_key?(:include_docs) ? opts : opts.merge({:include_docs => true})), &block
|
||||
view = fetch_view name, opts.merge({:include_docs => true}), &block
|
||||
view['rows'].collect{|r|new(r['doc'])} if view['rows']
|
||||
rescue
|
||||
# fallback for old versions of couchdb that don't
|
||||
|
|
Loading…
Reference in a new issue