The ancestry gem has a lot of methods to navigate the tree structure. You can do Model.roots to show all root elements etc. How do opposite? – return newest child for each tree structure.
I thought about adding an extra column to my model (latest/boolean) and then do some logic with after save filters etc. However this feels a bit clumsy. :/
Best regards.
Asbjørn Morell
Maybe you can hack something together with the
Class#inheritedhook, like updating an attribute of the parent model on creation of the new subclass:http://www.ruby-doc.org/core/classes/Class.html#M000177