Number of nodes per level in a nested set
2 answers
I actually figured out a "quick" way to do this. Using a segment from "Subtree Depth" on this page ( link text ) I am querying for depth using the given SQL using find_by_sql. Then I loop through the returned model results and count how many times each depth value occurs. Works great! Thanks everyone for watching and for your help!
0
user59278
source
to share
ActiveRecord has a counter_cache attribute that is made specifically for such cases. Check out Cache Counter Column , screencast by Ryan Bates.
+1
source to share