vault-rails 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Vault
2
2
  module Rails
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -139,7 +139,7 @@ class Vault
139
139
  # Merge in the updated attributes, if they're specified and defined on the object.
140
140
  if attributes?
141
141
  for attribute, value of attributes
142
- if object[attribute]? and attribute isnt @options['id_attribute']
142
+ if object[attribute]?
143
143
  object[attribute] = value
144
144
 
145
145
  # Store the collection.
@@ -257,12 +257,19 @@ class Vault
257
257
  url: @urls.create
258
258
  data: packaged_object
259
259
  fixture: (settings) =>
260
- settings.data.id = @date.getTime()
261
-
262
- return settings.data
260
+ return {
261
+ id: 123
262
+ make: "Dodge",
263
+ model: "Viper SRT-10",
264
+ year: 2008}
263
265
  success: (data) =>
264
- # Replace the existing object with the new one from the server and extend it.
265
- object = @extend data # This will also set its status to clean.
266
+ # Unlock the vault prematurely so that we can update it.
267
+ @locked = false
268
+
269
+ # Update the object with the attributes sent from the server.
270
+ object.update data, object.id
271
+
272
+ object.status = "clean"
266
273
  @dirty_object_count--
267
274
  error: =>
268
275
  @errors.push 'Failed to create.'
@@ -487,7 +494,7 @@ class Vault
487
494
  # Merge in the updated attributes, if they're specified and defined on the sub-object.
488
495
  if attributes?
489
496
  for attribute, value of attributes
490
- if sub_object[attribute]? and attribute isnt @options['id_attribute']
497
+ if sub_object[attribute]?
491
498
  sub_object[attribute] = value
492
499
 
493
500
  # Store the collection.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vault-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: