couchbase-model-relationship 0.1.5 → 0.1.6

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.
@@ -7,6 +7,7 @@ module Couchbase
7
7
 
8
8
  included do
9
9
  remove_method :write_attribute
10
+ remove_method :reload
10
11
 
11
12
  alias_method_chain :save, :dirty
12
13
  alias_method_chain :create, :dirty
@@ -33,6 +34,16 @@ module Couchbase
33
34
  @_attributes[name] = value
34
35
  end
35
36
 
37
+ # This is until my change http://review.couchbase.org/#/c/29745/ is in
38
+ # and released.
39
+ def reload
40
+ raise Couchbase::Error::MissingId, 'missing id attribute' unless @id
41
+ pristine = model.find(@id)
42
+ update_attributes(pristine.attributes)
43
+ @meta[:cas] = pristine.meta[:cas]
44
+ self
45
+ end
46
+
36
47
  def save_with_dirty(options = {})
37
48
  save_without_dirty(options).tap do |value|
38
49
  capture_previous_changes if value
@@ -1,7 +1,7 @@
1
1
  module Couchbase
2
2
  class Model
3
3
  module Relationship
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase-model-relationship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -218,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  segments:
220
220
  - 0
221
- hash: 2276442051598353428
221
+ hash: 4181024762891578791
222
222
  required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  none: false
224
224
  requirements:
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  version: '0'
228
228
  segments:
229
229
  - 0
230
- hash: 2276442051598353428
230
+ hash: 4181024762891578791
231
231
  requirements: []
232
232
  rubyforge_project:
233
233
  rubygems_version: 1.8.24