rails/rails — pull request #6105 by bploetz (2012-05-01 20:51:28+00:00)
Title: Support for underscores in module namespaces

As noted in https://github.com/rails/rails/issues/5849, Rails does not currently support module namespaces containing underscores. This is largely due to how ActiveSupport::Inflector.camelize and ActiveSupport::Inflector.underscore currently work.

This pull request essentially introduces a new convention whereby module namespaces containing underscores are translated to paths with *two* underscores for each underscore, and vice versa. For example:

"API::V0_1_0" --> "api/v0__1__0"

"api/v0__1__0" --> "API::V0_1_0"

I'm not married to this convention by any stretch, I'm just throwing it out there as a straw man.

In addition to this fix for the 3-2-stable branch, I've also made this change for the 3-0-stable, 3-1-stable, and master branches as well. You can find them in the following branches in my repo (if you want a separate pull request for each just let me know):

underscores-in-namespaces-3-0-stable
underscores-in-namespaces-3-1-stable
underscores-in-namespaces-3-2-stable
underscores-in-namespaces-master

I can also fix this for the 2.x series branches as well if you want, just let me know.

Thanks,
Brian