Consider this simple setup:
class Person
include Neo4j::ActiveNode
property :name, type: String
has_many :out, :follows, model_class: Person, rel_class: Friendship
has_many :in, :followed_by, model_class: Person, rel_class: Friendship
end
class Friendship
include Neo4j::ActiveRel
property :key, type: String
type 'friendship'
from_class Person
to_class Person
end
How would I search through all Friendship
s for those matching a condition? (e.g. Friendship
s of a certain key).
In an email, Brian Underwood points me to this snippet:
ModelClass.association_name(:node_var, :rel_var).where("rel_var = 'some_condition'")
I've tried playing around with it, but don't understand. Is ModelClass
an ActiveNode
or ActiveRel
instance? What is :node_var
and :rel_var
?