#106 ✓resolved
Andreas Ronge

has_one should replace old relationship

Reported by Andreas Ronge | February 8th, 2010 @ 10:48 AM | in 0.4.1

If a relationship has already been previously assigned it should be replaced when it assigned again with '='

http://github.com/andreasronge/neo4j/issues/issue/3

class A
  include Neo4j::NodeMixin
  has_one :a2b
end

a = A.new
b1 = Neo4j::Node.new

a.a2b = b1

# reassign
b1 = Neo4j::Node.new
a.a2b = b2

# This is the same as doing
a.rels.outgoing(:a2b) << b1
a.rels.outgoing(:a2b).first.del
a.rels.outgoing(:a2b) << b2

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