The ntee gem gives you a nice Ruby API for dealing with NTEE categories as objects. You can look up categories and their descriptions by NTEE code and navigate the taxonomy as a tree.
category=NTEE.category("R61")category.code# "R61"category.name# "Reproductive Rights"category.parent# NTEE.category("R60") - "Civil Liberties"category.ancestors# [NTEE.category("R60"), NTEE.category("R")]Easy-peasy!
There is also a helper method to make this easy to build Rails selection dropdowns
NTEE.as_listThe file lib/ntee/search_dimension.rb defines a few classes you can use in conjunction with Gively's search_dimensions gem to deal with NTEE categories stored in a Solr search index. NTEE::HierarchicalDimension lets you treat the categories as a hierarchical tree, and NTEE::FlatDimension lets you treat them as a plain string field.
This gem is Copyright © 2011-2012 Gively, Inc. and is released under the MIT license. For more details, please see the LICENSE file.
To test in console
bundle install
bundle exec rake test:console