neo4j 4.0.0.rc.3 → 4.0.0.rc.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: 28fe8a8c4370fbe08721a8ebd9f88665439a71f2
4
- data.tar.gz: 802a04febb895b8a561e4c82b9324b159c4eb68a
3
+ metadata.gz: d79cf5cc18db9fb5569ea5a2c096dcc5f29c7ead
4
+ data.tar.gz: 4e7b425de4468af56386de2c3f663498835b100c
5
5
  SHA512:
6
- metadata.gz: 37cbe5595a4991d3f13f44411c71e2c2ec4e3587489cdaec51f639668d94e3819dae84d4fc1213573fb76bac3e6f592ca3919617ea5fa1b9be840b767bf2fd41
7
- data.tar.gz: 61781492746a92e307d2bc5769ce7d0db389c06a16864c750cec5981067594fc553d0cd0330984b9fd009b76817380cf9f6cd4224334f4c8b60572472d67b241
6
+ metadata.gz: cbf9baeb9097961b6e60526ebc9619ee468f5000d64a22c5d0ec278127a50d016c8610ec4a5d5b80ebaebc6afd27b7566fb8dfdf11cf03df3120257e46eaf0d7
7
+ data.tar.gz: d47ad8ee3c67efd987867335a8a71a73ade28e3fe4e7ce72835d0aba76276d4b25fdb3bfd520a59a669f86b6ac73f07ad125b9f50980a847e9baf252925916c9
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 4.0.0.rc.4
2
+ * _classname property is disabled by default for ActiveRel! It had been disabled for ActiveNode, this just evens the score.
3
+ * Fixes a bug to create better `result` labels in Cypher.
4
+ * Made the `delete_all` and `destroy_all` ActiveNode class methods consistent with their ActiveRecord counterparts. `destroy_all` previously performed its deletes in Cypher but it should have been returning nodes to Ruby and calling `destroy`. `delete_all` didn't exist at all.
5
+
1
6
  == 4.0.0.rc.3
2
7
  Released minutes after rc.2 to catch one late addition!
3
8
  * Adds serialization support for QueryProxy.
@@ -119,7 +119,7 @@ module HasN
119
119
 
120
120
  instance_eval(%Q{
121
121
  def #{name}(node = nil, rel = nil, proxy_obj = nil)
122
- query_proxy = proxy_obj || Neo4j::ActiveNode::Query::QueryProxy.new(#{self.name}, nil, {
122
+ query_proxy = proxy_obj || Neo4j::ActiveNode::Query::QueryProxy.new(::#{self.name}, nil, {
123
123
  session: self.neo4j_session, query_proxy: nil, context: '#{self.name}' + '##{name}'
124
124
  })
125
125
  context = (query_proxy && query_proxy.context ? query_proxy.context : '#{self.name}') + '##{name}'
@@ -18,7 +18,17 @@ module Neo4j
18
18
  end
19
19
 
20
20
  def target_class_option(options)
21
- options[:model_class].nil? ? @target_class_name_from_name : options[:model_class]
21
+ if options[:model_class].nil?
22
+ if @target_class_name_from_name
23
+ "::#{@target_class_name_from_name}"
24
+ else
25
+ @target_class_name_from_name
26
+ end
27
+ elsif options[:model_class] == false
28
+ false
29
+ else
30
+ "::#{options[:model_class]}"
31
+ end
22
32
  end
23
33
 
24
34
  # Return cypher partial query string for the relationship part of a MATCH (arrow / relationship definition)
@@ -78,8 +88,19 @@ module Neo4j
78
88
  @relationship_class_name ||= @relationship_class.respond_to?(:constantize) ? @relationship_class : @relationship_class.name
79
89
  end
80
90
 
91
+ def relationship_clazz
92
+ @relationship_clazz ||= if @relationship_class.is_a?(String)
93
+ @relationship_class.constantize
94
+ elsif @relationship_class.is_a?(Symbol)
95
+ @relationship_class.to_s.constantize
96
+ else
97
+ @relationship_class
98
+ end
99
+ end
100
+
81
101
  def inject_classname(properties)
82
- properties[Neo4j::Config.class_name_property] = relationship_class_name if @relationship_class
102
+ return properties unless @relationship_class
103
+ properties[Neo4j::Config.class_name_property] = relationship_class_name if relationship_clazz.cached_class?(true)
83
104
  properties
84
105
  end
85
106
 
@@ -95,12 +95,18 @@ module Neo4j
95
95
  find_by(args) or raise RecordNotFound, "#{self.query_as(:n).where(n: a).limit(1).to_cypher} returned no results"
96
96
  end
97
97
 
98
- # Destroy all nodes and connected relationships
99
- def destroy_all
98
+ # Deletes all nodes and connected relationships from Cypher.
99
+ def delete_all
100
100
  self.neo4j_session._query("MATCH (n:`#{mapped_label_name}`)-[r]-() DELETE n,r")
101
101
  self.neo4j_session._query("MATCH (n:`#{mapped_label_name}`) DELETE n")
102
102
  end
103
103
 
104
+ # Returns each node to Ruby and calls `destroy`. Be careful, as this can be a very slow operation if you have many nodes. It will generate at least
105
+ # one database query per node in the database, more if callbacks require them.
106
+ def destroy_all
107
+ self.all.each { |n| n.destroy }
108
+ end
109
+
104
110
  # Creates a Neo4j index on given property
105
111
  #
106
112
  # This can also be done on the property directly, see Neo4j::ActiveNode::Property::ClassMethods#property.
@@ -279,8 +279,10 @@ module Neo4j
279
279
  def _result_string
280
280
  if self.association
281
281
  "result_#{self.association.name}".to_sym
282
- elsif self.model
283
- "result_#{self.model.name.tr!(':', '')}".to_sym
282
+ elsif self.model && self.model.name
283
+ label = "result_#{self.model.name}"
284
+ label.downcase!.tr!(':', '')
285
+ label.to_sym
284
286
  else
285
287
  :result
286
288
  end
data/lib/neo4j/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = "4.0.0.rc.3"
2
+ VERSION = "4.0.0.rc.4"
3
3
  end
data/neo4j.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.version = Neo4j::VERSION
10
10
  s.required_ruby_version = ">= 1.9.1"
11
11
 
12
- s.authors = "Andreas Ronge"
13
- s.email = 'andreas.ronge@gmail.com'
12
+ s.authors = "Andreas Ronge, Brian Underwood, Chris Grigg"
13
+ s.email = 'andreas.ronge@gmail.com, brian@brian-underwood.codes, chris@subvertallmedia.com'
14
14
  s.homepage = "https://github.com/neo4jrb/neo4j/"
15
15
  s.rubyforge_project = 'neo4j'
16
16
  s.summary = "A graph database for Ruby"
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: 4.0.0.rc.3
4
+ version: 4.0.0.rc.4
5
5
  platform: ruby
6
6
  authors:
7
- - Andreas Ronge
7
+ - Andreas Ronge, Brian Underwood, Chris Grigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter
@@ -96,7 +96,7 @@ dependencies:
96
96
  version: 3.1.0
97
97
  description: |
98
98
  A Neo4j OGM (Object-Graph-Mapper) for use in Ruby on Rails and Rack frameworks heavily inspired by ActiveRecord.
99
- email: andreas.ronge@gmail.com
99
+ email: andreas.ronge@gmail.com, brian@brian-underwood.codes, chris@subvertallmedia.com
100
100
  executables:
101
101
  - neo4j-jars
102
102
  extensions: []