neo4j 9.2.1 → 9.2.2

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: ed812d32cd486f6e304bccea02d2a17685f79da4
4
- data.tar.gz: 0616013941019bcc60f521317099908829732f3b
3
+ metadata.gz: 86f90dd15e03e5ac8d95b34b7366326afc53ceff
4
+ data.tar.gz: cce9e3dc22ed0865a39a1ade1513957b163bae77
5
5
  SHA512:
6
- metadata.gz: 34da0e1129e009f65a828b70604542243bbb759ef6c90769eadc0d3082260cf53c76339e0ab4f93d776e3aa44ba3e5e2af0c6f5a6b57586c224ea698efef7867
7
- data.tar.gz: 4428c77bd82200b118925452c26dbe0b5423bb43daedd4d2495fda4dea03258414b311c19ccf4751303453a7a43e7cee3ebc220508ba924be1aceea601e027da
6
+ metadata.gz: 515a2af0acd7c6aa3b4e74ddd869125ea46f33e8708a7eced151e059d21e09fb9aca31be415e87b95cfdd42cf1f0d435f95a4836371b436c70ed0411042051e0
7
+ data.tar.gz: 6957713e7f1f7657507c8415cf5856b7a02febee4b6ce9eb563aa20583b7cc80c3db5340043f3b9bea10cb45864c2039d7dad7cd00179f5990256ad8b2f2d2b8
@@ -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
+ ## [9.2.2] 2018-04-19
7
+
8
+ ## Fixed
9
+
10
+ - Introduced a fix to account for the fact that `ActiveModel` now returns a frozen `Hash` for `changed_attributes` (thanks @anamba and subvertallchris / see #1496 and #1499)
11
+
6
12
  ## [9.2.1] 2018-04-01
7
13
 
8
14
  ## Fixed
data/Gemfile CHANGED
@@ -23,6 +23,9 @@ end
23
23
 
24
24
  gem 'listen', '< 3.1'
25
25
 
26
+ active_model_version = ENV['ACTIVE_MODEL_VERSION']
27
+ gem 'activemodel', "~> #{active_model_version}" if active_model_version
28
+
26
29
  if RUBY_VERSION.to_f < 2.2
27
30
  gem 'activemodel', '~> 4.2'
28
31
  gem 'activesupport', '~> 4.2'
@@ -10,7 +10,7 @@ module Neo4j::ActiveNode::Initialize
10
10
  def init_on_load(persisted_node, properties)
11
11
  self.class.extract_association_attributes!(properties)
12
12
  @_persisted_obj = persisted_node
13
- changed_attributes && changed_attributes.clear
13
+ changed_attributes_clear!
14
14
  @attributes = convert_and_assign_attributes(properties)
15
15
  end
16
16
 
@@ -11,7 +11,7 @@ module Neo4j::ActiveRel
11
11
  def init_on_load(persisted_rel, from_node_id, to_node_id, type)
12
12
  @rel_type = type
13
13
  @_persisted_obj = persisted_rel
14
- changed_attributes && changed_attributes.clear
14
+ changed_attributes_clear!
15
15
  @attributes = convert_and_assign_attributes(persisted_rel.props)
16
16
  load_nodes(from_node_id, to_node_id)
17
17
  end
@@ -24,5 +24,31 @@ module Neo4j::Shared
24
24
  attr[key.freeze] = v
25
25
  end
26
26
  end
27
+
28
+ # We should be using #clear_changes_information
29
+ # but right now we don't use `ActiveModel` attributes correctly and so it doesn't work
30
+ def changed_attributes_clear!
31
+ return if changed_attributes.nil?
32
+
33
+ # changed_attributes is frozen starting with ActiveModel 5.2.0
34
+ # Not a good long term solution
35
+ if changed_attributes.frozen?
36
+ @attributes_changed_by_setter = ActiveSupport::HashWithIndifferentAccess.new
37
+ else
38
+ changed_attributes && changed_attributes.clear
39
+ end
40
+ end
41
+
42
+ def changed_attributes_selective_clear!(hash_to_clear)
43
+ # changed_attributes is frozen starting with ActiveModel 5.2.0
44
+ # Not a good long term solution
45
+ if changed_attributes.frozen?
46
+ attributes_changed_by_setter = ActiveSupport::HashWithIndifferentAccess.new(changed_attributes)
47
+ hash_to_clear.keys.each { |k| attributes_changed_by_setter.delete(k) }
48
+ @attributes_changed_by_setter = attributes_changed_by_setter
49
+ else
50
+ hash_to_clear.each_key { |k| changed_attributes.delete(k) }
51
+ end
52
+ end
27
53
  end
28
54
  end
@@ -14,7 +14,7 @@ module Neo4j::Shared
14
14
  props = props_for_update
15
15
  neo4j_query(query_as(:n).set(n: props))
16
16
  _persisted_obj.props.merge!(props)
17
- changed_attributes.clear
17
+ changed_attributes_clear!
18
18
  end
19
19
 
20
20
  def skip_update?
@@ -164,7 +164,7 @@ module Neo4j::Shared
164
164
  def reload
165
165
  return self if new_record?
166
166
  association_proxy_cache.clear if respond_to?(:association_proxy_cache)
167
- changed_attributes && changed_attributes.clear
167
+ changed_attributes_clear!
168
168
  unless reload_from_database
169
169
  @_deleted = true
170
170
  freeze
@@ -202,7 +202,7 @@ module Neo4j::Shared
202
202
  neo4j_query(query_as(:n).set(n: db_values))
203
203
  db_values.each_pair { |k, v| self.public_send(:"#{k}=", v) }
204
204
  _persisted_obj.props.merge!(db_values)
205
- db_values.each_key { |k| changed_attributes.delete(k) }
205
+ changed_attributes_selective_clear!(db_values)
206
206
  true
207
207
  end
208
208
  end
@@ -242,7 +242,7 @@ module Neo4j::Shared
242
242
  .pluck("#{element_name}.`#{attribute}`").first
243
243
  return false unless new_attribute
244
244
  self[attribute] = new_attribute
245
- changed_attributes.delete(attribute)
245
+ set_attribute_was(attribute, new_attribute)
246
246
  true
247
247
  end
248
248
 
@@ -11,6 +11,10 @@ module Neo4j::Shared
11
11
 
12
12
  attr_reader :_persisted_obj
13
13
 
14
+ def mutations_from_database
15
+ ActiveModel::NullMutationTracker.instance
16
+ end
17
+
14
18
  def inspect
15
19
  attribute_descriptions = inspect_attributes.map do |key, value|
16
20
  "#{Neo4j::ANSI::CYAN}#{key}: #{Neo4j::ANSI::CLEAR}#{value.inspect}"
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '9.2.1'
2
+ VERSION = '9.2.2'
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: 9.2.1
4
+ version: 9.2.2
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: 2018-04-01 00:00:00.000000000 Z
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel