Re: about: neo4j.rb and ruby on rails activerecord‏ in a web project

96 views
Skip to first unread message

Brian Underwood

unread,
Oct 13, 2014, 8:36:28 AM10/13/14
to neo...@googlegroups.com
Certainly you can use the neo4j gem and ActiveRecord at the same time!
So this screencast shows you how to set up a neo4j focused app:

https://www.youtube.com/watch?v=bDjbqRL9HcM&list=UUIURLB8eZjFU8AH-GKeQI6g

But in the comments I give some detail on how to configure it for
both. The main bit is that you need to change your application.rb
(either if you start with a neo4j rails app or if you start with a
default rails app). Let me know if you have any trouble with it.

Brian
;p

On Mon, Oct 13, 2014 at 2:32 PM, <fap2...@gmail.com> wrote:
> Hello
>
> I'm a student, who are making a researching on something like "how to use
> graph database along with postgres db in a Ruby on rails project". I was
> wondering if I can use neo4j.rb along with activerecord or is there some
> practically good way of using both a postgres db and a neo4j graph database.
>
>
> Hope my writing makes sense.
>
> --
> You received this message because you are subscribed to the Google Groups
> "neo4jrb" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4jrb+u...@googlegroups.com.
> To post to this group, send email to neo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/neo4jrb.
> For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted
Message has been deleted

fap2...@gmail.com

unread,
Oct 13, 2014, 9:15:22 AM10/13/14
to neo...@googlegroups.com
hank you very much! Do you have any deeper documentation on how neo4jrb works
under the hood? I'm asking this for 2 reasons:

1. I'm making a research paper on graph databases and I have to argument why I use
neo4rb for connecting to my neo4j database.


2. because the following sentence I read on https://devcenter.heroku.com/articles/graphenedb confuses me. Does it mean that neo4jrb replaces
active record or what does it mean?

"If you want to use Neo4j instead of or in additional to SQL in Ruby on Rails"

Chris Grigg

unread,
Oct 14, 2014, 12:33:12 PM10/14/14
to neo...@googlegroups.com
Yes, Neo4j::ActiveNode replaces ActiveRecord within models. The relationship between ActiveRecord and ActiveNode is just like the relationship between ActiveRecord and Mongoid: the new gem apes the functionality of ActiveRecord to provide a familiar experience to Rails users.

What kind of deeper documentation are you looking for? Between the wiki, the specs, YARD, and the code itself, it's all pretty open but I know it can be a little hard to get your bearings and make sense of the order methods are called and how it actually works. If you have some specific questions in mind, let us know and we can try to help.

fap2...@gmail.com

unread,
Oct 15, 2014, 12:58:56 AM10/15/14
to neo...@googlegroups.com
Arh ok, thanks. Do you have any specific in depths documents, where I can read about the relationship between activerecord and activenode? I'm doing a research paper on
graph databases, and I have to argument about why I'm using neo4jrb instead of some other connection for a ruby on rails project.

Brian Underwood

unread,
Oct 15, 2014, 1:58:47 AM10/15/14
to neo...@googlegroups.com
There's no relationship between them.  I think the only thing Chris is saying is that our gem was inspired by and does pretty much the same thing as ActiveRecord.  ActiveRecord::Base is a class you inherit from to make an ActiveRecord model and Neo4j::ActiveNode and Neo4j::ActiveRel are modules which you can mix in to your model classes to basically do the same thing.  They don't affect each other at all unless you subclass ActiveRecord and include our modules in the same class, which I don't recommend.  You can have models for both in the same application at the same time.

Brian
;p


markt

unread,
Oct 15, 2014, 2:59:52 AM10/15/14
to neo...@googlegroups.com
Ok. So, what you are saying is that there is no way of using the same model class for both postgres and neo4j database? I dont know if I ever want to do that. However, does it mean that I can specifically use neo4jrb for certain models and activerecord for others?



-------- Oprindelig meddelelse --------
Fra: Brian Underwood <br...@semi-sentient.com>
Dato:
Til: neo...@googlegroups.com
Emne: Re: about: neo4j.rb and ruby on rails activerecord‏ in a web project

Brian Underwood

unread,
Oct 15, 2014, 6:25:11 AM10/15/14
to neo...@googlegroups.com
That's right, though there's nothing stopping you from duplicating data between the two databases.  I have a project with an Ar::Resident class and a Neo::Resident class.  Of course my data doesn't really change so I don't need to worry about synchronization there, but I believe that's what the neoid gem is for (though I don't think it's updated to support the 3.0 of our gem)

Brian
;p

fap2...@gmail.com

unread,
Oct 19, 2014, 10:13:37 AM10/19/14
to neo...@googlegroups.com
I hope you will create a document that give a deep explanation on how neo4jrb works under the covers. I would really like to know more about how neo4jrb works, because I have to write about it in my research paper and why I chose this gem instead of some other gem for my ruby on rails project.
Reply all
Reply to author
Forward
0 new messages