jchris-couchrest 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/couchrest/core/database.rb +9 -3
- metadata +2 -2
data/Rakefile
CHANGED
@@ -64,17 +64,23 @@ module CouchRest
|
|
64
64
|
end
|
65
65
|
if doc['_id']
|
66
66
|
slug = CGI.escape(doc['_id'])
|
67
|
+
CouchRest.put "#{@root}/#{slug}", doc
|
67
68
|
else
|
68
|
-
|
69
|
+
begin
|
70
|
+
slug = doc['_id'] = @server.next_uuid
|
71
|
+
CouchRest.put "#{@root}/#{slug}", doc
|
72
|
+
rescue #old version of couchdb
|
73
|
+
CouchRest.post @root, doc
|
74
|
+
end
|
69
75
|
end
|
70
|
-
CouchRest.put "#{@root}/#{slug}", doc
|
71
76
|
end
|
72
77
|
|
73
78
|
def bulk_save docs
|
74
79
|
ids, noids = docs.partition{|d|d['_id']}
|
75
80
|
uuid_count = [noids.length, @server.uuid_batch_count].max
|
76
81
|
noids.each do |doc|
|
77
|
-
|
82
|
+
nextid = @server.next_uuid(uuid_count) rescue nil
|
83
|
+
doc['_id'] = nextid if nextid
|
78
84
|
end
|
79
85
|
CouchRest.post "#{@root}/_bulk_docs", {:docs => docs}
|
80
86
|
end
|
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.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J. Chris Anderson
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-10 21:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|