neo4j 6.0.3 → 6.0.4

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: a52df19251c38a7049d0b9278957d4082d5e383c
4
- data.tar.gz: 85fa3a60b9010119344fb6f1483552c6d3c9b975
3
+ metadata.gz: 8753bbe4fbbcae1dff577b11647a0820121d448b
4
+ data.tar.gz: 4b8672e9fc47bd07df4dcb7b3be15f7110f24b27
5
5
  SHA512:
6
- metadata.gz: c4382d6c1b6c775bd9ef932550e43b5c442ef1e75c5013a9fc310741440af660972a9efb72394b3acbd2fd0608a7fd810838a299061d9d65de8230d7688c6794
7
- data.tar.gz: 7d1531abe853894486407d1cd17d5e6367fbd2a7cc035dac29c1056bc6e9bd374195a98b2cff77f986c0cffe537c925ebea62049ba48e900fb44a8564361cf4c
6
+ metadata.gz: d3eb1743258e2049d1a35a9d726fe960e21bbf488d70ab40b316dd8b8b74bbf69dcf0b9f66973a828d7aed6773a34e8046bacf14f0752694e9cce3b3e123b79b
7
+ data.tar.gz: 9bd62e09506edc3daa6b769e1fa40e032fbb9c59db50a1fa29d5c56812011fd660a48c5b81dbada76264571197cc6875fc38570be8a45d42ecf36ef20c5b9d9a
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
3
3
  This file should follow the standards specified on [http://keepachangelog.com/]
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [6.0.4] - 12-23-2015
7
+
8
+ ### Fixed
9
+
10
+ - When a `model_class` is specified on an association which is not an ActiveNode model, an error is raised
11
+
6
12
  ## [6.0.3] - 12-18-2015
7
13
 
8
14
  ### Fixed
@@ -91,9 +91,17 @@ module Neo4j
91
91
  def target_class
92
92
  return @target_class if @target_class
93
93
 
94
- @target_class = target_class_names[0].constantize if target_class_names && target_class_names.size == 1
94
+ if target_class_names && target_class_names.size == 1
95
+ class_const = target_class_names[0].constantize
96
+
97
+ if !class_const.included_modules.include?(Neo4j::ActiveNode)
98
+ fail ArgumentError, "Invalid argument to `#{name}` association: `#{class_const.inspect}` is not an ActiveNode model"
99
+ end
100
+
101
+ @target_class = class_const
102
+ end
95
103
  rescue NameError
96
- raise ArgumentError, "Could not find `#{@target_class}` class and no :model_class specified"
104
+ raise ArgumentError, "Invalid argument to `#{name}` association: Could not find class `#{target_class_names[0]}`"
97
105
  end
98
106
 
99
107
  def callback(type)
@@ -13,4 +13,9 @@ module Neo4j::ActiveNode::Initialize
13
13
  changed_attributes && changed_attributes.clear
14
14
  @attributes = convert_and_assign_attributes(properties)
15
15
  end
16
+
17
+ def init_on_reload(reloaded)
18
+ @attributes = nil
19
+ init_on_load(reloaded, reloaded.props)
20
+ end
16
21
  end
@@ -15,5 +15,14 @@ module Neo4j::ActiveRel
15
15
  @attributes = convert_and_assign_attributes(persisted_rel.props)
16
16
  load_nodes(from_node_id, to_node_id)
17
17
  end
18
+
19
+ def init_on_reload(unwrapped_reloaded)
20
+ @attributes = nil
21
+ init_on_load(unwrapped_reloaded,
22
+ unwrapped_reloaded._start_node_id,
23
+ unwrapped_reloaded._end_node_id,
24
+ unwrapped_reloaded.rel_type)
25
+ self
26
+ end
18
27
  end
19
28
  end
@@ -72,6 +72,10 @@ module Neo4j::ActiveRel
72
72
  def create_method
73
73
  creates_unique? ? :create_unique : :create
74
74
  end
75
+
76
+ def load_entity(id)
77
+ Neo4j::Relationship.load(id)
78
+ end
75
79
  end
76
80
 
77
81
  def create_method
@@ -137,11 +137,8 @@ module Neo4j::Shared
137
137
  end
138
138
 
139
139
  def reload_from_database
140
- # TODO: - Neo4j::IdentityMap.remove_node_by_id(neo_id)
141
- if reloaded = self.class.load_entity(neo_id)
142
- send(:attributes=, reloaded.attributes)
143
- end
144
- reloaded
140
+ reloaded = self.class.load_entity(neo_id)
141
+ reloaded ? init_on_reload(reloaded._persisted_obj) : nil
145
142
  end
146
143
 
147
144
  # Updates this resource with all the attributes from the passed-in Hash and requests that the record be saved.
@@ -53,6 +53,11 @@ module Neo4j::Shared
53
53
  hash.each { |key, value| send("#{key}=", value) }
54
54
  end
55
55
 
56
+ def reload_properties!(properties)
57
+ @attributes = nil
58
+ convert_and_assign_attributes(properties)
59
+ end
60
+
56
61
  protected
57
62
 
58
63
  # This method is defined in ActiveModel.
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '6.0.3'
2
+ VERSION = '6.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.3
4
+ version: 6.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter