0
我有表如何在Model Activrecord Rails中獲取樹?
id | name |pid
--------------------
1 | Cetegory1 | 0
--------------------
2 | SubCatregory1 | 1
--------------------
3 | SubCatregory2 | 1
--------------------
4 | Cetegory2 | 0
--------------------
5 | SubCatregory1 | 4
--------------------
6 | SubCatregory2 | 4
如何選擇樹Categoryes從該表中ActeveRecord Rails3中?
- 類別1
- 子類別1
- 子類別2
- 類別2
- 子類別1
- 子類別2
非常感謝! – user2425138