Fix underscore inflector handling of namespaced and adjacent acronyms

The underscore inflector regular expression was not working correctly
for namespaced acronyms that were not entirely uppercased
(e.g. HTTP::RESTful) or adjacent acronyms (e.g. APIRESTful).

I suspect that positive lookbehind would have been used in the
original implementation had it been available in supported Ruby
versions at the time. Now that Rails requires Ruby 1.9.2 or above,
this is no longer an issue.

Thanks to Pawel Kozlowski (khozlov) for highlighting the namespace
issue in #8571.