Here is my Neo4j Active Node
class User
include Neo4j::ActiveNode
has_many :out, :following, type: :following, model_class: 'User'
end
john = User.find(:name => "John")
tom = User.find(:name => "Tom")
john.following << tom
john.following.count
john.following << tom
john.following.count
I want to create a unique relationship.
To avoid duplication, we should use create unique when creating a request for a cypher relationship.
Example:
MATCH (root { name: 'root' })
CREATE UNIQUE (root)-[:LOVES]-(someone)
RETURN someone
refer: http://neo4j.com/docs/stable/query-create-unique.html
How can I do this in Neo4j.rb with Rails ...?
Thanks in advance.
source
share