Browse files

Fix replication with couchdb 1.1.0.

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...
1 parent 7f5f1ae commit 40e73141c6dc79c4584b49d1b50a2d4e526c9062 @erickt erickt committed Aug 12, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/couchrest/database.rb
3 lib/couchrest/database.rb
@@ -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
payload['target'] = other_db.root
payload['continuous'] = continuous
- payload['doc_ids'] = options[:doc_ids] if options[:doc_ids]
+ payload['doc_ids'] = doc_ids if doc_ids "#{@host}/_replicate", payload

0 comments on commit 40e7314

Please sign in to comment.