回答

5

嘗試acts_as_tree插件

+0

我也發現這個:http://github.com/rails/acts_as_nested_set – 2010-04-20 15:55:33

5

Awesome_nested_set是最好的解決方案,國際海事組織,這些類型結構的軌道。 http://github.com/collectiveidea/awesome_nested_set

+0

同意。在寫作時它很討厭,但當涉及到讀取時,它會踢屁股。您可以通過一個查詢獲取整個樹結構。 – changelog 2010-04-21 12:40:05