instance method
humanize
Ruby on Rails 4.2.9
Since v3.0.20Signature
humanize(options = {})
Capitalizes the first word, turns underscores into spaces, and strips a trailing ‘_id’ if present. Like titleize, this is meant for creating pretty output.
The capitalization of the first word can be turned off by setting the optional parameter capitalize to false. By default, this parameter is true.
'employee_salary'.humanize # => "Employee salary" 'author_id'.humanize # => "Author" 'author_id'.humanize(capitalize: false) # => "author" '_id'.humanize # => "Id"
Parameters
-
optionsopt = {}
Source
# File activesupport/lib/active_support/core_ext/string/inflections.rb, line 203
def humanize(options = {})
ActiveSupport::Inflector.humanize(self, options)
end
Defined in activesupport/lib/active_support/core_ext/string/inflections.rb line 203
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in String