Hello, I have a class "ve" which acts_as_tree and has an attribute "recommendations", which is itself another model (referenced by a belongs_to, has_many relationship, a "ve" has many recommendations) I wish I could get all recommendations for a specific node, knowing that this number would be the sum of its own recommendations and those of its children, and it''s children''s children and so on. I think the best wat to do it is through a helper, but I get stuck wit the algorithm. For exemple, if I want only to get the sum of all recommendations present, it''s easy throgh the folowing helper (which even might be more performant, i guess) def get_recommandations_number(node, ret) if node.has_children? for n in node.children ret = get_recommandations_number(n, ret) end end ret += node.recommendations.count end However, being recommendations another model, I can''t get it through the same algorithm. I hope there''s an easy way, but I am not very good with ruby. Would anybody please help me? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---