neo4j 7.1.4 → 7.2.0
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 +4 -4
- data/CHANGELOG.md +3 -9
- data/lib/neo4j.rb +1 -0
- data/lib/neo4j/active_node.rb +3 -2
- data/lib/neo4j/active_node/query/query_proxy_link.rb +1 -5
- data/lib/neo4j/active_rel.rb +3 -21
- data/lib/neo4j/active_rel/persistence.rb +3 -16
- data/lib/neo4j/shared/permitted_attributes.rb +28 -0
- data/lib/neo4j/version.rb +1 -1
- metadata +3 -3
- data/bin/rake +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa5400aef5ceed374df507212001259434a2550c
|
4
|
+
data.tar.gz: eb182d51d5f9107155dcc3cc7db72018b0ca16ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d12724bd745a9d23b43a63f90a6bcd18114727035229cea23cf744db4ea0482832e4c44696246224f34b93ea3d3d091afa49bf8096b3a80ec695a92d68cb42c3
|
7
|
+
data.tar.gz: 609c35501f8b8a2ac5588820867d3c972f1ca1ce5dbe73456a3ff4f2de62e1f6a943eefcd2eb5098053bbc474dbf65baa63d0b6639f947f533f685e1a58accde
|
data/CHANGELOG.md
CHANGED
@@ -3,11 +3,11 @@ 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
|
-
## [7.
|
6
|
+
## [7.2.0] - 08-23-2016
|
7
7
|
|
8
|
-
###
|
8
|
+
### Added
|
9
9
|
|
10
|
-
-
|
10
|
+
- Backporting #1245 to 7.x versions. It implements the [`ForbiddenAttributesProtection` API](http://edgeapi.rubyonrails.org/classes/ActionController/StrongParameters.html) from ActiveRecord.
|
11
11
|
|
12
12
|
## [7.1.3] - 08-18-2016
|
13
13
|
|
@@ -34,12 +34,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
34
34
|
- Gemspec dependency requirements were modified where ActiveModel, ActiveSupport, and Railties are concerned. The gem now requires >= 4.0, < 5.1.
|
35
35
|
- `ActiveModel::Serializers::Xml` is only included if supported if available.
|
36
36
|
|
37
|
-
## [7.0.16] - 09-20-2016
|
38
|
-
|
39
|
-
### Fixed
|
40
|
-
|
41
|
-
- `where` clause with question mark parameter and array values only using the first element (see #1247 #1290)
|
42
|
-
|
43
37
|
## [7.0.15] - 08-18-2016
|
44
38
|
|
45
39
|
### Changed
|
data/lib/neo4j.rb
CHANGED
data/lib/neo4j/active_node.rb
CHANGED
@@ -44,10 +44,11 @@ module Neo4j
|
|
44
44
|
include Neo4j::ActiveNode::Scope
|
45
45
|
include Neo4j::ActiveNode::Dependent
|
46
46
|
include Neo4j::ActiveNode::Enum
|
47
|
+
include Neo4j::Shared::PermittedAttributes
|
47
48
|
|
48
49
|
def initialize(args = nil)
|
49
|
-
|
50
|
-
super(
|
50
|
+
args = sanitize_input_parameters(args)
|
51
|
+
super(args)
|
51
52
|
end
|
52
53
|
|
53
54
|
def neo4j_obj
|
data/lib/neo4j/active_rel.rb
CHANGED
@@ -18,13 +18,14 @@ module Neo4j
|
|
18
18
|
include Neo4j::ActiveRel::Query
|
19
19
|
include Neo4j::ActiveRel::Types
|
20
20
|
include Neo4j::Shared::Enum
|
21
|
+
include Neo4j::Shared::PermittedAttributes
|
21
22
|
|
22
23
|
class FrozenRelError < Neo4j::Error; end
|
23
24
|
|
24
25
|
def initialize(from_node = nil, to_node = nil, args = nil)
|
25
26
|
load_nodes(node_or_nil(from_node), node_or_nil(to_node))
|
26
27
|
resolved_args = hash_or_nil(from_node, args)
|
27
|
-
symbol_args = resolved_args
|
28
|
+
symbol_args = sanitize_input_parameters(resolved_args)
|
28
29
|
super(symbol_args)
|
29
30
|
end
|
30
31
|
|
@@ -60,26 +61,7 @@ module Neo4j
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def hash_or_nil(node_or_hash, hash_or_nil)
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
module ClassMethods
|
67
|
-
[:create, :create!].each do |meth|
|
68
|
-
define_method(meth) do |from_node_or_args = nil, to_node = nil, args = nil|
|
69
|
-
return super(from_node_or_args) if from_node_or_args.is_a?(Hash)
|
70
|
-
args_hash = args || {}
|
71
|
-
args_with_node!(:from_node, from_node_or_args, args_hash)
|
72
|
-
args_with_node!(:to_node, to_node, args_hash)
|
73
|
-
super(args_hash)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
def args_with_node!(key, node, args)
|
80
|
-
args[key] = node if node.is_a?(Neo4j::ActiveNode)
|
81
|
-
args
|
82
|
-
end
|
64
|
+
hash_or_parameter?(node_or_hash) ? node_or_hash : hash_or_nil
|
83
65
|
end
|
84
66
|
end
|
85
67
|
end
|
@@ -55,26 +55,13 @@ module Neo4j::ActiveRel
|
|
55
55
|
module ClassMethods
|
56
56
|
# Creates a new relationship between objects
|
57
57
|
# @param [Hash] props the properties the new relationship should have
|
58
|
-
def create(
|
59
|
-
|
60
|
-
new(props).tap do |obj|
|
61
|
-
relationship_props.each do |prop, value|
|
62
|
-
obj.send("#{prop}=", value)
|
63
|
-
end
|
64
|
-
obj.save
|
65
|
-
end
|
58
|
+
def create(*args)
|
59
|
+
new(*args).tap(&:save)
|
66
60
|
end
|
67
61
|
|
68
62
|
# Same as #create, but raises an error if there is a problem during save.
|
69
63
|
def create!(*args)
|
70
|
-
|
71
|
-
relationship_props = extract_association_attributes!(props) || {}
|
72
|
-
new(props).tap do |obj|
|
73
|
-
relationship_props.each do |prop, value|
|
74
|
-
obj.send("#{prop}=", value)
|
75
|
-
end
|
76
|
-
obj.save!
|
77
|
-
end
|
64
|
+
new(*args).tap(&:save!)
|
78
65
|
end
|
79
66
|
|
80
67
|
def create_method
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Neo4j::Shared
|
2
|
+
module PermittedAttributes
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
include ActiveModel::ForbiddenAttributesProtection
|
5
|
+
|
6
|
+
def process_attributes(attributes)
|
7
|
+
attributes = sanitize_input_parameters(attributes)
|
8
|
+
super(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
def attributes=(attributes)
|
12
|
+
attributes = sanitize_input_parameters(attributes)
|
13
|
+
super(attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# Check if an argument is a string or an ActionController::Parameters
|
19
|
+
def hash_or_parameter?(args)
|
20
|
+
args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)
|
21
|
+
end
|
22
|
+
|
23
|
+
def sanitize_input_parameters(attributes)
|
24
|
+
attributes = sanitize_for_mass_assignment(attributes)
|
25
|
+
attributes.respond_to?(:symbolize_keys) ? attributes.symbolize_keys : attributes
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/neo4j/version.rb
CHANGED
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: 7.
|
4
|
+
version: 7.2.0
|
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: 2016-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: orm_adapter
|
@@ -232,7 +232,6 @@ files:
|
|
232
232
|
- Gemfile
|
233
233
|
- README.md
|
234
234
|
- bin/neo4j-jars
|
235
|
-
- bin/rake
|
236
235
|
- config/locales/en.yml
|
237
236
|
- config/neo4j/add_classnames.yml
|
238
237
|
- config/neo4j/config.yml
|
@@ -304,6 +303,7 @@ files:
|
|
304
303
|
- lib/neo4j/shared/initialize.rb
|
305
304
|
- lib/neo4j/shared/marshal.rb
|
306
305
|
- lib/neo4j/shared/mass_assignment.rb
|
306
|
+
- lib/neo4j/shared/permitted_attributes.rb
|
307
307
|
- lib/neo4j/shared/persistence.rb
|
308
308
|
- lib/neo4j/shared/property.rb
|
309
309
|
- lib/neo4j/shared/query_factory.rb
|
data/bin/rake
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
#
|
4
|
-
# This file was generated by Bundler.
|
5
|
-
#
|
6
|
-
# The application 'rake' is installed as part of a gem, and
|
7
|
-
# this file is here to facilitate running it.
|
8
|
-
#
|
9
|
-
|
10
|
-
require 'pathname'
|
11
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
12
|
-
Pathname.new(__FILE__).realpath)
|
13
|
-
|
14
|
-
require 'rubygems'
|
15
|
-
require 'bundler/setup'
|
16
|
-
|
17
|
-
load Gem.bin_path('rake', 'rake')
|