Set the route constraints for names groups and classes
Avoid nil when sorting
Rails 3.2 has replaced AssociationCollection with CollectionAssociation, so remove this monkey patch
Move find_by_id_or_name to a module and extend with it