I'm trying to create simple geo-model with tree-structure with Rails4. Every region has one parent region and can have many children regions.
class Region < ActiveRecord::Base
has_many :regions, belongs_to :region, dependent: :destroy
end
Schema:
create_table "regions", force: true do |t|
t.string "name"
t.string "description"
t.integer "region_id"
t.datetime "created_at"
t.datetime "updated_at"
end
Unfortunatelly, such code is not working. What should i do?