union_cypher
method on Neo4j::Core::Query
object. https://github.com/neo4jrb/neo4j-core/blob/master/lib/neo4j/core/query.rb#L389
ActiveNode
have this equivalent? https://blog.bigbinary.com/2016/05/09/rails-5-allows-updating-without-updating-timestamps.html
PROFILE MATCH (n:Client) WITH count(n) as counted_n MATCH (m:Client) RETURN m, counted_n LIMIT 25
config.neo4j.session.options = { adaptor_class: Neo4j::Core::CypherSession::Adaptors::Driver }
in application.rb, but there is nothing about the version that uses seabolt. I have installed seabolt, and it works, I have installed the neo4j-ruby-driver and I can run the example code in my console but how do I hook it up so Neo4j::Core uses it? When I attempt with setting the session options, I get the following error: uninitialized constant Neo4j::Core::CypherSession::Adaptors::Driver (NameError)
I'm on neo4j-core version 9.0.0 and neo4j version 9.6.0. Is the infrastructure for it even there yet?
This is clunky, but if you make an initializer in Rails.root/config/initializers/neo4j.rb
and put in
config = YAML.load(File.read(::Rails.root.to_s + '/config/neo4j.yml'))[::Rails.env].symbolize_keys
Neo4j::ActiveBase.current_adaptor = Neo4j::Core::CypherSession::Adaptors::Driver.new(config[:url])
It will use the driver. It's ugly, and what is needed is that in this file: https://github.com/neo4jrb/neo4j/blob/0ce207eccd8fe12db7c5bf7fd1f6cd8e0dfef1c9/lib/neo4j/session_manager.rb
the private method adaptor_class_by_type
needs an extra option called "driver". If that is put in, it will make things work, I think.
config/neo4j.ym
as described here https://neo4jrb.readthedocs.io/en/stable/Setup.html#rails-configuration not work for you? Why are you loading the file in initializer?
@klobuczek That isn't woking, no, if I pick bolt it will not use the neo4j-ruby-driver, and I cannot pick embedded, because I am not using jruby. If I pick nothing, it defaults to http, which also does not use the driver. If you want that to work, you have to make an option called "driver" in the session manager file. Also, the seabolt environment needs to be declared before neo4j-ruby-driver is required. I mean, in principle you should put it in application.rb, but that is not the rails way of doing it. Isolation it in the initializer is the best way to do it, and I would still use it to declare the environment variable, even if the session manager supported using the driver. There are other gems that installs their own initializers, if they are rails specific (like devise, aasm and money, to mention a few), it is pretty standard behavior.
While you are at it, it would be nice if datetimes were not converted to integers when using neo4j-ruby-driver. I guess that is a neo4j-core change.
session.type
since it is explicitely specified with a class. The embedded
in the docs is a mistake.
code
and thus belonging to initializer.`class Thing
include Neo4j::ActiveNode
has_one :out, :locates, rel_class: :ThingLocation, model_class: :Location
end
class Location
include Neo4j::ActiveNode
has_one :in, :thing, rel_class: :ThingLocation, model_class: :Thing
end
class ThingLocation
include Neo4j::ActiveRel
from_class :Thing
to_class :Location
type :thing_location
creates_unique
end`
ThingLocation.create(...)
. There is a current limitation with gem to respect has_one
relationship. You can set up a config flag (enforce_has_one: true
) in your rails app to raise error in such scenarios. https://github.com/neo4jrb/neo4j/blob/master/docs/Configuration.rst Build on documentation has not run for a while, will check on that. We need to work on this issue to fix it properly.