class String

def underscore

"ActiveModel::Errors".underscore # => "active_model/errors"
"ActiveModel".underscore # => "active_model"

+underscore+ will also change '::' to '/' to convert namespaces to paths.

The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
def underscore
  ActiveSupport::Inflector.underscore(self)
end