jchris-couchrest 0.12.4 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -149,16 +149,18 @@ module CouchRest
149
149
  # missing ids, supply one from the uuid cache.
150
150
  #
151
151
  # If called with no arguments, bulk saves the cache of documents to be bulk saved.
152
- def bulk_save (docs = nil)
152
+ def bulk_save(docs = nil, use_uuids = true)
153
153
  if docs.nil?
154
154
  docs = @bulk_save_cache
155
155
  @bulk_save_cache = []
156
156
  end
157
- ids, noids = docs.partition{|d|d['_id']}
158
- uuid_count = [noids.length, @server.uuid_batch_count].max
159
- noids.each do |doc|
160
- nextid = @server.next_uuid(uuid_count) rescue nil
161
- doc['_id'] = nextid if nextid
157
+ if (use_uuids)
158
+ ids, noids = docs.partition{|d|d['_id']}
159
+ uuid_count = [noids.length, @server.uuid_batch_count].max
160
+ noids.each do |doc|
161
+ nextid = @server.next_uuid(uuid_count) rescue nil
162
+ doc['_id'] = nextid if nextid
163
+ end
162
164
  end
163
165
  CouchRest.post "#{@root}/_bulk_docs", {:docs => docs}
164
166
  end
data/lib/couchrest.rb CHANGED
@@ -25,7 +25,7 @@ require 'couchrest/monkeypatches'
25
25
 
26
26
  # = CouchDB, close to the metal
27
27
  module CouchRest
28
- VERSION = '0.12.4'
28
+ VERSION = '0.12.5'
29
29
 
30
30
  autoload :Server, 'couchrest/core/server'
31
31
  autoload :Database, 'couchrest/core/database'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jchris-couchrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.4
4
+ version: 0.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - J. Chris Anderson