instance method
underscore
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
underscore()
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
Source
# File activesupport/lib/active_support/core_ext/string/inflections.rb, line 71
def underscore
Inflector.underscore(self)
end
Defined in activesupport/lib/active_support/core_ext/string/inflections.rb line 71
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::CoreExtensions::String::Inflections