Permalink
Browse files

fixes bug when trying to bulk-load non-existant documents

  • Loading branch information...
langalex committed Aug 22, 2012
1 parent a3fa2a5 commit f464cbce5953cda2c8a80a1fcd025e8a90e4804a
Showing with 2 additions and 3 deletions.
  1. +1 −2 lib/couch_potato/database.rb
  2. +1 −1 spec/unit/database_spec.rb
@@ -146,8 +146,7 @@ def couchrest_database
def bulk_load(ids)
response = couchrest_database.bulk_load ids
- existing_rows = response['rows'].select{|row| row.key? 'doc'}
- docs = existing_rows.map{|row| row["doc"]}
+ docs = response['rows'].map{|row| row["doc"]}.compact
docs.each{|doc| doc.database = self}
end
@@ -73,7 +73,7 @@ class Child
let(:doc1) { DbTestUser.new }
let(:doc2) { DbTestUser.new }
let(:response) do
- {"rows" => [{}, {"doc" => doc1}, {"doc" => doc2}]}
+ {"rows" => [{'doc' => nil}, {"doc" => doc1}, {"doc" => doc2}]}
end
before(:each) do

0 comments on commit f464cbc

Please sign in to comment.