我有具有树结构的类别模型。在我的数据库中,我有大约 1500 条记录。当我尝试使用命令“Category.build_ancestry_from_parent_ids!”从父 ID 重建祖先时 结果我得到零。
这是结果。
1.9.2p290 :006 > Category.build_ancestry_from_parent_ids!类别负载 (1.8ms) SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL AND ("categories"."id" >= 0) ORDER BY "categories"."id" ASC LIMIT 1000 => 无
我正在遵循https://github.com/stefankroes/ancestry的指示,但似乎我错过了一些东西。
有没有人以前有同样的问题?