So I'm looking for a gem that will bring some tree behavior to the pages model.
From wh开发者_Python百科at 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.
I recommend Closure Tree. His author introduces good resources and reasons for it here.
Take a look at Ancestry, it's remarkably efficient.
check out here
https://www.ruby-toolbox.com/categories/Active_Record_Nesting
I prefer awesome_nested_set
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
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.
精彩评论