couchbase-orm 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11c2ad7ff34f37ae315cd7c9a3fdc7a6996227e2
4
- data.tar.gz: 3f6aefaa94d88a6aaebad20bedb1c78a28a70008
3
+ metadata.gz: 97d4d22e92253cd711eac00f3ef2be972e6a7edf
4
+ data.tar.gz: 54c9999852f93b4e3cdbc0902e2f5e1eb5d41410
5
5
  SHA512:
6
- metadata.gz: c4ddb04a7d3bd75b42ea33c95d3381796c765232b13dff8a06210ed229282bbc061700c85966b79728fc57ab2d95c68d7559dec0c2a1752a334e2db113c4a9e7
7
- data.tar.gz: 0e2364c88a7b6bee5ae8e3f0ce236fcab13fca16d404f3c2089cc73d9fd3f1d242a6065d81148df495b6f9f3828f46a2a2305c1a88370d7c750b15440b7209b1
6
+ metadata.gz: 0697517128397f38ed0e449ffc284a7df7023c73d04eeebd25d03cfc50af43702950d258a9de536835439bfd3ecddb0b29083df0bb5a583669f1ada6e69b00da
7
+ data.tar.gz: ade8348fee4da31af06dcf5174dfe68b8b13619d5a490470add44e85c7d74983722223b8f076ab55cb03f2f9a76f7776c8fc910ebf31e6bb83df44e35a143fb5
@@ -150,11 +150,11 @@ module CouchbaseOrm
150
150
  @__metadata__.cas = model.cas
151
151
 
152
152
  # This ensures that defaults are applied
153
- super(**doc)
153
+ @__attributes__.merge! doc
154
154
  when CouchbaseOrm::Base
155
155
  attributes = model.attributes
156
156
  attributes.delete(:id)
157
- super(**attributes)
157
+ @__attributes__ = attributes
158
158
  else
159
159
  super(**attributes.merge(Hash(model)))
160
160
  end
@@ -212,6 +212,12 @@ module CouchbaseOrm
212
212
  end
213
213
  end
214
214
 
215
+ ID_LOOKUP = ['id', :id].freeze
216
+ def read_attribute_for_serialization(attr)
217
+ return self.id if ID_LOOKUP.include?(attr)
218
+ @__attributes__[attr]
219
+ end
220
+
215
221
 
216
222
  #
217
223
  # Add support for comparisons
@@ -36,7 +36,9 @@ module Rails #:nodoc:
36
36
  def self.rescue_responses
37
37
  {
38
38
  'Libcouchbase::Error::KeyNotFound' => :not_found,
39
- 'Libcouchbase::Error::NotStored' => :unprocessable_entity
39
+ 'Libcouchbase::Error::NotStored' => :unprocessable_entity,
40
+ Libcouchbase::Error::KeyNotFound => :not_found,
41
+ Libcouchbase::Error::NotStored => :unprocessable_entity
40
42
  }
41
43
  end
42
44
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true, encoding: ASCII-8BIT
2
2
 
3
3
  module CouchbaseOrm
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase-orm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-11 00:00:00.000000000 Z
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libcouchbase