Skip to content

Commit

Permalink
merge test release into master
Browse files Browse the repository at this point in the history
  • Loading branch information
subvertallchris committed Aug 27, 2014
2 parents 4a90bfd + 24fb8ca commit 78d0576
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 27 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG
@@ -1,5 +1,14 @@
== 3.0.0.rc.2
* Use newer neo4j-core release

== 3.0.0.rc.1
* Support for count, size, length, empty, blank? for has_many relationship
* Support for rails logger of cypher queries in development
* Support for distinct count
* Optimized methods: https://github.com/andreasronge/neo4j/wiki/Optimized-Methods
* Queries should respect mapped label names (#421)
* Warn if no session is available
* Fix broken == and equality
* Fix broken == and equality (#424)

== 3.0.0.alpha.11
* Bug fixes
Expand Down
27 changes: 18 additions & 9 deletions README.md
Expand Up @@ -2,22 +2,31 @@

Neo4j.rb is an Active Model compliant Ruby/JRuby wrapper for [the Neo4j graph database](http://www.neo4j.org/). It uses the [neo4j-core](https://github.com/andreasronge/neo4j-core) and [active_attr](https://github.com/cgriego/active_attr) gems.

## Version 3.0.0.alpha.X
## Documentation version 3.0.0.rc

Unstable !
* [Wiki](https://github.com/andreasronge/neo4j/wiki/Neo4j.rb-v3-Introduction)

* [Wiki](https://github.com/andreasronge/neo4j/wiki/Neo4j-v3)
* [Basic Rails 4 Example](https://github.com/andreasronge/neo4j/blob/master/example/blog/README.md)
## Documentation Old stable version 2.x

## Version 2.x
* [README](https://github.com/andreasronge/neo4j/tree/2.x)
* [Wiki](https://github.com/andreasronge/neo4j/wiki/Neo4j%3A%3ARails-Introduction)

## Support

* [Neo4j.rb mailing list](https://groups.google.com/forum/#!forum/neo4jrb)
* Consulting support ? ask any of the developers

## Developers

* [Andreas Ronge](https://github.com/andreasronge)
* [Brian Underwood](https://github.com/cheerfulstoic)
* [Chris Grigg](https://github.com/subvertallchris)

For the stable 2.x version, see [here](https://github.com/andreasronge/neo4j/tree/2.x)

## Contributing

* Have you found a bug, need help, or have a patch ?
* Just clone neo4j.rb and send me a pull request or email me.
* Do you need help - send me an email (andreas.ronge at gmail dot com).
Pull request with high test coverage and good [code climate](https://codeclimate.com/github/andreasronge/neo4j) values will be accepted faster.


## License

Expand Down
4 changes: 1 addition & 3 deletions lib/neo4j/active_node/has_n.rb
Expand Up @@ -7,7 +7,7 @@ class NonPersistedNodeError < StandardError; end
module ClassMethods

def has_association?(name)
!!associations[name]
!!associations[name.to_sym]
end

def associations
Expand All @@ -25,7 +25,6 @@ def has_many(direction, name, options = {})
name = name.to_sym

association = Neo4j::ActiveNode::HasN::Association.new(:has_many, direction, name, options)
name = name.to_sym

@associations ||= {}
@associations[name] = association
Expand Down Expand Up @@ -78,7 +77,6 @@ def has_one(direction, name, options = {})
name = name.to_sym

association = Neo4j::ActiveNode::HasN::Association.new(:has_one, direction, name, options)
name = name.to_sym

@associations ||= {}
@associations[name] = association
Expand Down
9 changes: 9 additions & 0 deletions lib/neo4j/active_node/query/query_proxy.rb
Expand Up @@ -111,6 +111,15 @@ def create(other_nodes, properties)
raise "Can only create associations on associations" unless @association
other_nodes = [other_nodes].flatten

other_nodes.map! do |other_node|
case other_node
when Integer, String
@model.find(other_node)
else
other_node
end
end

raise ArgumentError, "Node must be of the association's class when model is specified" if @model && other_nodes.any? {|other_node| other_node.class != @model }
other_nodes.each do |other_node|
#Neo4j::Transaction.run do
Expand Down
2 changes: 1 addition & 1 deletion lib/neo4j/version.rb
@@ -1,3 +1,3 @@
module Neo4j
VERSION = "3.0.0.alpha.11"
VERSION = "3.0.0.rc.2"
end
14 changes: 7 additions & 7 deletions lib/rails/generators/neo4j/model/model_generator.rb
Expand Up @@ -9,7 +9,7 @@ class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base #:nodoc:
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
class_option :indices, :type => :array, :desc => "The properties which should be indexed"
class_option :has_one, :type => :array, :desc => "A list of has_one relationships"
class_option :has_n, :type => :array, :desc => "A list of has_n relationships"
class_option :has_many, :type => :array, :desc => "A list of has_many relationships"

def create_model_file
template "model.erb", File.join('app/models', "#{singular_name}.rb")
Expand All @@ -24,14 +24,14 @@ def timestamps?
options[:timestamps]
end

def has_n?
options[:has_n]
def has_many?
options[:has_many]
end

def has_n_statements
def has_many_statements
txt = ""
options[:has_n].each do |key|
txt << has_x('has_n', key)
options[:has_many].each do |key|
txt << has_x('has_many', key)
end
txt
end
Expand Down Expand Up @@ -79,4 +79,4 @@ def timestamp_statements
end

hook_for :test_framework
end
end
9 changes: 4 additions & 5 deletions lib/rails/generators/neo4j/model/templates/model.erb
@@ -1,11 +1,10 @@
class <%= class_name %> <%= parent? ? "#{options[:parent].classify}" : "" %>
include Neo4j::ActiveNode
include Neo4j::ActiveNode
<% attributes.each do |attribute| -%>
property :<%= attribute.name %><%= ", type: #{attribute.type_class}" unless attribute.type_class == 'any' %>
<%= index_fragment(attribute.name) %>
property :<%= attribute.name %><%= ", type: #{attribute.type_class}" unless attribute.type_class == 'any' %><%= "\n " + index_fragment if index_fragment = index_fragment(attribute.name) %>
<% end -%>
<%= has_n_statements if has_n? -%>
<%= has_many_statements if has_many? -%>
<%= has_one_statements if has_one? -%>
<%= timestamp_statements if timestamps? -%>
end
end
2 changes: 1 addition & 1 deletion neo4j.gemspec
Expand Up @@ -34,7 +34,7 @@ It comes included with the Apache Lucene document database.
s.add_dependency("activesupport", "~> 4")
s.add_dependency("railties", "~> 4")
s.add_dependency('active_attr', "~> 0.8")
s.add_dependency("neo4j-core", "= 3.0.0.rc.4")
s.add_dependency("neo4j-core", "~> 3.0.0.rc.4")

if RUBY_PLATFORM =~ /java/
s.add_dependency("neo4j-community", '~> 2.0')
Expand Down

0 comments on commit 78d0576

Please sign in to comment.