Skip to content

Instantly share code, notes, and snippets.

@noahmatisoff
Created March 23, 2015 21:09
Show Gist options
  • Save noahmatisoff/03cc524bcc5084248a9e to your computer and use it in GitHub Desktop.
Save noahmatisoff/03cc524bcc5084248a9e to your computer and use it in GitHub Desktop.
Active Record self-referential one to one relationship
has_one :twin_model, class_name: "Model", foreign_key: :model_id
belongs_to :twin, class_name: "Model", foreign_key: :model_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment