diff --git a/lib/couchrest/model/views.rb b/lib/couchrest/model/views.rb index bd5c0bc..68e55bd 100644 --- a/lib/couchrest/model/views.rb +++ b/lib/couchrest/model/views.rb @@ -127,18 +127,11 @@ module CouchRest if raw || (opts.has_key?(:include_docs) && opts[:include_docs] == false) fetch_view(db, name, opts, &block) else - begin - if block.nil? - collection_proxy_for(design_doc, name, opts.merge({:include_docs => true})) - else - view = fetch_view db, name, opts.merge({:include_docs => true}), &block - 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'] + if block.nil? + collection_proxy_for(design_doc, name, opts.merge({:database => db, :include_docs => true})) + else + view = fetch_view db, name, opts.merge({:include_docs => true}), &block + view['rows'].collect{|r|create_from_database(r['doc'])} if view['rows'] end end end