Skip to content

Commit

Permalink
Fix replication with couchdb 1.1.0.
Browse files Browse the repository at this point in the history
couchdb 1.1.0 has a bug where it will error out
if /_replicate is passed a doc_ids with a null
value. This patch works around that bug by
not including a null doc_ids in the first place.
  • Loading branch information
erickt committed Dec 2, 2011
1 parent 7f5f1ae commit 40e7314
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/couchrest/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,15 @@ def delete_attachment(doc, name, force=false)
def replicate(other_db, continuous, options)
raise ArgumentError, "must provide a CouchReset::Database" unless other_db.kind_of?(CouchRest::Database)
raise ArgumentError, "must provide a target or source option" unless (options.key?(:target) || options.key?(:source))
doc_ids = options.delete(:doc_ids)
payload = options
if options.has_key?(:target)
payload['source'] = other_db.root
else
payload['target'] = other_db.root
end
payload['continuous'] = continuous
payload['doc_ids'] = options[:doc_ids] if options[:doc_ids]
payload['doc_ids'] = doc_ids if doc_ids
CouchRest.post "#{@host}/_replicate", payload
end

Expand Down

0 comments on commit 40e7314

Please sign in to comment.