Many modern web apps are built on Ruby and Rails, so it is important to learn how to access Neo4j embedded using Ruby.
Andreas Ronge has written the Ruby bindings in JRuby, which utilizes the neo4j
Java library underneath it. It can be embedded into an existing Rails application very easily.
This project can be accessed at https://github.com/neo4jrb/neo4j-core.
This project comes with an excellent documentation on how to use it with the Rail application.
Install gem
neo4j-core
on the machine, using the gem install neo4j-core
command.
The complete documentation has been provided at https://github.com/neo4jrb/neo4j-core/wiki.
One sample example of creating nodes and relationships is shown as follows:
node = Neo4j::Node.create({name: 'neo'}, :hero, :human) puts "Created node #{node[:name]} with labels #{node.labels.join(', ')}" n1 = Neo4j::Node.create n2 = Neo4j::Node.create rel = n1.create_rel(:knows, n2, since: 2015)