Skip to content

Neo4j.rb v3 Tips and Related Gems

Andreas Ronge edited this page Aug 26, 2014 · 8 revisions

Preventing Cypher Injection

Always use params with queries to protect yourself from Cypher injection. It also allows the server to cache execution paths, which will lead to better performance.

Student.lessons(:l, :r).where("r.grade > '{grade}'").params(grade: 89)

Testing

Testing

Install a Neo4j test server

rake neo4j:install[community-2.1.3,test]

Configure it using a different server port e.g. 7475

rake neo4j:config[test,7475]

Edit the test configuration `config/environments/test'

config.neo4j.session_type = :server_db
config.neo4j.session_path = 'http://localhost:7475'

See example: Rails Blog Example

Related Gems

Screen Casts

Neo4j with devise

See https://github.com/benjackson/devise-neo4j. Use the 2.0.0.alpha.X versions. See example application: https://github.com/andreasronge/rails-devise

neo4j-will_paginate

See https://github.com/subvertallchris/neo4j-will_paginate

neo4jrb-paperclip

Leo Lou's original gem updated for Neo4j.rb 3.0. See https://github.com/subvertallchris/neo4jrb-paperclip

Rails Example

See Rails 4 example: https://github.com/andreasronge/neo4j/tree/3.0/example/blog

Neo4j Core

The neo4j gem uses the neo4j-core gem, see https://github.com/andreasronge/neo4j-core See https://github.com/andreasronge/neo4j-core/tree/3.0

Clone this wiki locally