Skip to content

Instantly share code, notes, and snippets.

@subvertallchris
Created September 30, 2014 00:15
Show Gist options
  • Save subvertallchris/c0bff2f4e0e544e412fe to your computer and use it in GitHub Desktop.
Save subvertallchris/c0bff2f4e0e544e412fe to your computer and use it in GitHub Desktop.
movies models?
class Movie
include Neo4j::ActiveNode
id_property :title
has_many :in, :actors, model_class: :Person, rel_class: Engagement
end
class Engagement
include Neo4j::ActiveRel
from_class Person
to_class Movie
type 'ACTED_IN'
property :roles
end
class Person
include Neo4j::ActiveNode
id_property :name
has_many :out, :acted_in, model_class: :Movie, rel_class: Engagement
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment