Posts

Showing posts with the label neo4j

How to do rake db:seed in using neo4j gem in rails 4

Neo4j is a graph database, using neo4j gem( https://github.com/neo4jrb/neo4 j) we can easily use neo4j database in our ruby on rails application ( http://programminginrubyonrails.blogspot.in/2014/12/neo-4j-with-rails.html ). Till now neo4j gem does not support rake db tasks. You can check all the supported task by typing rake -T in your console. Now we can create our own custom rake task to seed some  data in neo4j . Step 1: Create a file under lib/tasks name it seed.rake Step 2: Put the below code in seed.rake. namespace :db do   desc 'Load the seed data from db/seeds.rb'   task :seed => :environment do     seed_file = File.join(Rails.root, 'db', 'seeds.rb')     load(seed_file) if File.exist?(seed_file)   end end That's it. now you can run rake db:seed from your terminal.. Simple :) 

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