Skip to content

Instantly share code, notes, and snippets.

@wmoxam
Created August 22, 2008 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmoxam/6802 to your computer and use it in GitHub Desktop.
Save wmoxam/6802 to your computer and use it in GitHub Desktop.
class Item
has_many :relations
has_many :related_items, :through => :relations, :source => :item, :foreign_key => 'related_item_id'
end
class Relation
belongs_to :item
belongs_to :related_item, :class => 'Item', :source => :item
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment