Skip to content

Instantly share code, notes, and snippets.

@latortuga
Created February 20, 2012 20:43
Show Gist options
  • Save latortuga/1871299 to your computer and use it in GitHub Desktop.
Save latortuga/1871299 to your computer and use it in GitHub Desktop.
has_many :child_connections, :class_name => 'Connection', :foreign_key => 'from_id'
has_many :parent_connections, :class_name => 'Connection', :foreign_key => 'to_id', :dependent => :destroy
has_many :children, :through => :child_connections, :source => :to
has_many :parents, :through => :parent_connections, :source => :from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment