Rails 3, what's the best act as tree behavior?

眉间皱痕 提交于 2019-12-10 09:54:14

问题


So I'm looking for a gem that will bring some tree behavior to the pages model.

From what I can see there are quite a few, I was wondering what other people thought.

If there any great ones or and dodgy ones to avoid.

Cheers.


回答1:


Take a look at Ancestry, it's remarkably efficient.




回答2:


I recommend Closure Tree. His author introduces good resources and reasons for it here.




回答3:


check out here

https://www.ruby-toolbox.com/categories/Active_Record_Nesting

I prefer awesome_nested_set




回答4:


Seems like the most popular is AwesomeNestedSet https://github.com/collectiveidea/awesome_nested_set

It has categories ordering system, what is missing in others and all standart functions. Setup is pretty well docummented




回答5:


I have implemented acts_as_tree successfully for some threaded comments, but am not impressed by its performance-handling. It was very simple to implement, though.

By default, it now queries the database once for every node in the tree. I suspect with some clever settings and some optimisation this can be solved though, but, out of the box: not too impressed.



来源:https://stackoverflow.com/questions/5474402/rails-3-whats-the-best-act-as-tree-behavior

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!