Skip to content

Instantly share code, notes, and snippets.

@simpsonjulian
Last active April 3, 2020 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simpsonjulian/84c0bad03ffbb4c4ce8a6a67ef370efe to your computer and use it in GitHub Desktop.
Save simpsonjulian/84c0bad03ffbb4c4ce8a6a67ef370efe to your computer and use it in GitHub Desktop.
# Usage: rails new myapp -m neo4j.rb -O
gem "neo4j", '~> 9.6.1'
generator = %q[
config.generators do |g|
g.orm :neo4j
end
# Configure where to connect to the Neo4j DB
# Note that embedded db is only available for JRuby
# config.neo4j.session.type = :http
# config.neo4j.session.url = 'http://localhost:7474'
# or
config.neo4j.session.type = :bolt
config.neo4j.session.url = 'bolt://localhost:7687'
# or
# config.neo4j.session.type = :embedded
# config.neo4j.session.path = Rails.root.join('neo4j-db').to_s
]
application generator
inject_into_file 'config/application.rb', "\nrequire 'neo4j/railtie'", after: 'require "active_record/railtie"'
inject_into_file 'config/application.rb', "\nrequire 'neo4j/railtie'", after: "require 'rails/all'"
yaml_data = <<YAML
development:
type: bolt
url: http://localhost:7687
test:
type: bolt
url: http://localhost:7687
YAML
create_file 'config/neo4j.yml.example', yaml_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment