解决方法
最简单的方法:
class MyModel < ActiveRecord::Base belongs_to :parent,:class_name => 'MyModel' has_many :children,:class_name => 'MyModel',:foreign_key => 'parent_id' end