Set up Neo 4j With Rails In Ubuntu
How to setup new 4j database with Rails 4.
Step 1: Install Neo4j Database in ubuntu.
login as Admin
sudo -i
wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -
Add Neo4J to the Apt sources list:
echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j.list
Update the package manager:
exit as admin
apt-get update
Install Neo4J:
apt-get install neo4j
sudo /etc/init.d/neo4j-service restart
Step 2: Create a new rails project.
Rails new neo4j
Step 3: Add neo4j Gem in your gem file
gem 'neo4j', github: 'andreasronge/neo4j'
Step 4: Go to application.rb
require File.expand_path('../boot', __FILE__)
require "rails"
%w(
neo4j
action_controller
action_mailer
sprockets
).each do |framework|
begin
require "#{framework}/railtie"
rescue LoadError
end
end
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Neo4j
class Application < Rails::Application
config.neo4j.session_type = :server_db
config.neo4j.session_path = ENV['GRAPHENEDB_URL'] || 'http://localhost:7474'
end
end
Step 4: Go to development.rb and comment the line
# config.active_record.migration_error = :page_load
Step 5: Go to Rake file and modify this lines(Not necessary )
Now then, within the Rakefile, set it to this:
require File.expand_path('../config/application', __FILE__)
load 'neo4j/tasks/neo4j_server.rake'
Rails.application.load_tasks
Step 6: Go to application.rb file and add the below line.
config.generators { |g| g.orm :neo4j }
For more info please check
https://github.com/neo4jrb/neo4j
http://blog.benmorgan.io/post/88913410501/getting-started-with-neo4j-ruby-2-1-2-and-rails
Step 1: Install Neo4j Database in ubuntu.
login as Admin
sudo -i
wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -
Add Neo4J to the Apt sources list:
echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j.list
Update the package manager:
exit as admin
apt-get update
Install Neo4J:
apt-get install neo4j
sudo /etc/init.d/neo4j-service restart
Step 2: Create a new rails project.
Rails new neo4j
Step 3: Add neo4j Gem in your gem file
gem 'neo4j', github: 'andreasronge/neo4j'
Step 4: Go to application.rb
require File.expand_path('../boot', __FILE__)
require "rails"
%w(
neo4j
action_controller
action_mailer
sprockets
).each do |framework|
begin
require "#{framework}/railtie"
rescue LoadError
end
end
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Neo4j
class Application < Rails::Application
config.neo4j.session_type = :server_db
config.neo4j.session_path = ENV['GRAPHENEDB_URL'] || 'http://localhost:7474'
end
end
Step 4: Go to development.rb and comment the line
# config.active_record.migration_error = :page_load
Step 5: Go to Rake file and modify this lines(Not necessary )
Now then, within the Rakefile, set it to this:
require File.expand_path('../config/application', __FILE__)
load 'neo4j/tasks/neo4j_server.rake'
Rails.application.load_tasks
Step 6: Go to application.rb file and add the below line.
config.generators { |g| g.orm :neo4j }
For more info please check
https://github.com/neo4jrb/neo4j
http://blog.benmorgan.io/post/88913410501/getting-started-with-neo4j-ruby-2-1-2-and-rails
Comments
Post a Comment