Reputation: 3888
I Need to check relation between two nodes exists already.
brian.following << chris
brian.following
#=> chris
I Need to check like this
brian.following?(chris)
#=> true
brian.following?(john)
#=> false
Any method is there in neo4j.rb for this?
if not, How can i write my custom method for this in Neo4j.rb-Rails ?
Upvotes: 1
Views: 426
Reputation: 5482
You can do brian.following.include?(chris)
. Check out https://github.com/neo4jrb/neo4j/wiki/Optimized-Methods, it details this and many other helpful methods that are either modified versions of those found in Enumerable and unique to QueryProxy. You'll also find examples of these in https://github.com/neo4jrb/neo4j/blob/master/spec/e2e/query_proxy_methods_spec.rb.
Upvotes: 4