embark-journey 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18c9b267ba2cffc78635ed6da60a9fc0cdd541f7
4
- data.tar.gz: 2ee2f6281fa95ab36e8cb447b8772cd5ac4fe137
3
+ metadata.gz: 177f36337f55709ec264098ecc3f810226a77c30
4
+ data.tar.gz: f33b30380f80fb669218b4bc72be8c1f1562325d
5
5
  SHA512:
6
- metadata.gz: 45cead5f6647b4a247627480fc3d57f4e2d3b71cb338a2c54ac2312215cb3ba933900f58ad123b9764f45da84e7c38048da416f91ff9d5573a6848773efdc997
7
- data.tar.gz: db86af47a90b175ea80e6e36b73c65736bc32498ae3041210a8235eb6aa3cfa8b850329b7ae3874fbf9883923f8caa537e76c6474a44d64ec6a2c81009cda695
6
+ metadata.gz: 925c574614b4e687671dd66fc8fd752e64a01fd34060ffc236d62d6ba8420bd5ee14e6e27214d0b4ee6cb6aac38a500d3dedfa86aecb5bc9c73e0f6cd1df2846
7
+ data.tar.gz: 75eec0780c5007d96a2ebb4e13c6d62ca752bd65a05094a71dcb5f49e2ce3e92babb15d32ccc310ef0708be1058a012f09d182cae61532f1bb98ab52f88bfd2e
@@ -126,8 +126,8 @@ module ActiveResource::Associations
126
126
  end
127
127
 
128
128
  define_method(method_name) do
129
- if instance_variable_defined?(ivar_name)
130
- instance_variable_get(ivar_name)
129
+ if ivar = instance_variable_get(ivar_name)
130
+ ivar
131
131
  elsif attributes.include?(method_name)
132
132
  attributes[method_name]
133
133
  elsif association_id = send(finder_key)
@@ -7,10 +7,19 @@ module Journey::Resource::AttributeLoading
7
7
  def load(attributes, remove_root = false, persisted = false)
8
8
  # 'data' is a reserved key in ActiveResource,
9
9
  # but Journey uses it for the Oplog
10
- attributes['content'] = attributes.delete('data')
10
+ if content = attributes.delete('data')
11
+ attributes['content'] = content
12
+ end
11
13
 
12
14
  super(attributes, remove_root, persisted).tap do
13
15
 
16
+ # set the cached value of any updated associations (e.g. parent_id)
17
+ # to nil so that they can be re-fetched
18
+ attributes.keys.map(&:to_s).select{ |key| key =~ /_id$/ }.each do |association_key|
19
+ association = association_key.gsub /_id$/, ''
20
+ instance_variable_set("@#{association}", nil)
21
+ end
22
+
14
23
  # allow enum_sets to be loaded by key (rather than index)
15
24
  # by auto-converting them on initialization
16
25
  if enum_sets = self.class.instance_variable_get(:@enum_sets)
@@ -2,7 +2,7 @@ module Journey
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 5
5
+ TINY = 6
6
6
  PRE = nil
7
7
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embark-journey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Davey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-11 00:00:00.000000000 Z
11
+ date: 2015-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_attr