Method: String#underscore

Defined in:
lib/active_support/core_ext/string/inflections.rb

#underscoreObject

The reverse of camelize. Makes an underscored, lowercase form from the expression in the string.

underscore will also change ‘::’ to ‘/’ to convert namespaces to paths.

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


118
119
120
# File 'lib/active_support/core_ext/string/inflections.rb', line 118

def underscore
  ActiveSupport::Inflector.underscore(self)
end