STI attachment Definitions, spec and fix

See https://github.com/thoughtbot/paperclip/issues/1330.

This solution works by iterating through all the ancestors of the class and checking the class name to see if it's registered.  I don't love it because ancestors lists can get quite long, especially in rails, but I can't think of a better way to do it.