Organize ActiveRecord models into a tree using PostgreSQL's ltree datatype