Raj Adroit
Raj Adroit

Reputation: 3888

Should I use JRuby or Ruby for Rails with Neo4j.rb?

I'm using Neo4j.rb for Integrating Neo4j Graph database with Rails.

Should I use JRuby or Ruby?

What's the difference (any pros/cons) when using neo4j.rb with JRuby and Ruby?

Some of the examples are telling to use JRuby and I'm able to execute the Rails application with Ruby also.

Upvotes: 4

Views: 335

Answers (2)

Brian Underwood
Brian Underwood

Reputation: 10856

I'm one of the maintainers of Neo4j.rb and you can use it with both JRuby as well as the official interpreter (MRI/KRI/whetever. I'll call it MRI from here on out). There is a lot of outdated information out there because in version 2.x and previous the gem DID require JRuby. Starting with version 3.0 it is no longer required.

The gem hasn't been (though probably should be) tested with other interpreters.

The gem supports both server and embedded modes.

  • Server: Connecting to an external Neo4j database instance with the REST API
  • Embedded: Running Neo4j in the Ruby process

Server is supported by both MRI and JRuby. Embedded is only supported under JRuby.

The advantage of embedded mode is direct access to the database via the Neo4j Java APIs, which gets you a lot more speed, but is more complex. One disadvantage is that your ruby process is now your server process, so if you want to deploy/do maintenance, it becomes trickier.

The advantage of the server mode is having the nice separation of concerns. Connection via cypher queries is relatively simple.

With server mode you can use ActiveNode and ActiveRel. Actually, I'd bet you can probably use ActiveNode and ActiveRel with embedded, too, though I hardly used embedded mode myself, so I can't say for certain.

Upvotes: 7

Ahmed Reza
Ahmed Reza

Reputation: 33

Neo4j.rb works best with ruby for rails you should go with it

Upvotes: -3

Related Questions