Skip to content

Instantly share code, notes, and snippets.

@farmanp
Created December 29, 2016 20:58
Show Gist options
  • Save farmanp/b29bfc4d34b7ced6c21d859651cde420 to your computer and use it in GitHub Desktop.
Save farmanp/b29bfc4d34b7ced6c21d859651cde420 to your computer and use it in GitHub Desktop.
Posts relationships
class Comment
include Neo4j::ActiveNode
property :name, type: String
property :content, type: String
has_one :out, :post, type: :post
has_one :in, :post, rel_class: :AgreeComment
has_one :in, :post, rel_class: :DisagreeComment
end
class Post
include Neo4j::ActiveNode
property :title, type: String
property :text, type: String
property :link, type: String
# has_many :in, :comments, type: nil
has_many :out, :comments, rel_class: :AgreeComment
has_many :out, :comments, rel_class: :DisagreeComment
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment