#104 ✓resolved
Andreas Ronge

Access declared/prefixed relationships for has_n and has_one

Reported by Andreas Ronge | January 28th, 2010 @ 01:41 PM | in 0.4.0

Problem

Since ticket #92 adds a prefix to declared relationship there is a need to access those relationship without knowing the prefix.

Solution

Generate <rel name>_rels method when a relationship is declared by has_n
Generate <rel name>_rel method when a relationship is declared by has_one

Example

 class Movie
  include Neo4j::NodeMixin
  has_n(:actors).to(Actor)
 end
This let's us get both the Actor nodes and the relationship object between Movie and Actor.
Example
  move.actors.each {|node| print all actors}
  move.actors_rels.each {|rel| print all relationship}
For a has_one there should the method _rel should be generated.

The rails example should also be updated to use this feature.

For more information see the email discussion on the neo4jrb mailing list

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Neo4j.rb is a graph database framework for JRuby.

It provides:

* Mapping of ruby objects to nodes in networks rather than in tables.
* Storage of ruby object to a file system.
* Fast traversal of relationships between nodes in a hugh node space.
* Transaction with rollbacks support.
* Indexing and quering of ruby objects.
* Integration with Rails

People watching this ticket

Referenced by

Pages