Skip to content

Instantly share code, notes, and snippets.

@bricker
Created September 17, 2012 16:11
Show Gist options
  • Save bricker/3738238 to your computer and use it in GitHub Desktop.
Save bricker/3738238 to your computer and use it in GitHub Desktop.
# create_table "areas" to |t|
# t.string :title
# t.integer :parent_id
# end
class Area
has_many :children, class_name: "Area", foreign_key: "parent_id"
belongs_to :parent
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment