Fixing big problem with lack of database passed to collection proxy
This commit is contained in:
parent
c52f009270
commit
efb07295f0
|
@ -127,18 +127,11 @@ module CouchRest
|
||||||
if raw || (opts.has_key?(:include_docs) && opts[:include_docs] == false)
|
if raw || (opts.has_key?(:include_docs) && opts[:include_docs] == false)
|
||||||
fetch_view(db, name, opts, &block)
|
fetch_view(db, name, opts, &block)
|
||||||
else
|
else
|
||||||
begin
|
if block.nil?
|
||||||
if block.nil?
|
collection_proxy_for(design_doc, name, opts.merge({:database => db, :include_docs => true}))
|
||||||
collection_proxy_for(design_doc, name, opts.merge({:include_docs => true}))
|
else
|
||||||
else
|
view = fetch_view db, name, opts.merge({:include_docs => true}), &block
|
||||||
view = fetch_view db, name, opts.merge({:include_docs => true}), &block
|
view['rows'].collect{|r|create_from_database(r['doc'])} if view['rows']
|
||||||
view['rows'].collect{|r|create_from_database(r['doc'])} if view['rows']
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
# fallback for old versions of couchdb that don't
|
|
||||||
# have include_docs support
|
|
||||||
view = fetch_view(db, name, opts, &block)
|
|
||||||
view['rows'].collect{|r|create_from_database(db.get(r['id']))} if view['rows']
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue