Method: ActiveSupport::CoreExtensions::String::Inflections#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.

"ActiveRecord".underscore         # => "active_record"
"ActiveRecord::Errors".underscore # => active_record/errors


71
72
73
# File 'lib/active_support/core_ext/string/inflections.rb', line 71

def underscore
  Inflector.underscore(self)
end