Has intarray been considered as an option for the ancestry field type when using postgres?
As far as I can tell the order is significant and it can be indexed so should be fast in comparison to string filtering.
https://github.com/dockyard/postgres_ext adds native support to Rails for it and I think I read somewhere that it might be included by default in Rails 4.0?
Interesting! If Rails 4 includes it by default, it may be a good choice to include it. On the other hand we prefer to keep dependencies to a minimum, so do not expect inclusion of the feature very soon.
This gem looks great. When reading through the documentation, however, the only thing that gave me pause was: "[ancestry] uses a ‘like’ condition in order to fetch descendants".
I think using an indexed array for the materialized paths would be awesome.
Edit: just came across an article talking about how they do just that at DISQUS: http://justcramer.com/2012/04/08/using-arrays-as-materialized-paths-in-postgres/
Postgres has a much better option than intarray, that is a string (dot-separated ids) with a ltree index. It naturally supports prefix and other type of searches, and it is thought explicitly for trees.
+1 for postgres ltree support.