class String
def humanize(capitalize: true, keep_id_suffix: false)
'author_id'.humanize(keep_id_suffix: true) # => "Author id"
'_id'.humanize # => "Id"
'author_id'.humanize(capitalize: false) # => "author"
'author_id'.humanize # => "Author"
'employee_salary'.humanize # => "Employee salary"
By default, this parameter is false.
optional parameter +keep_id_suffix+ to true.
The trailing '_id' can be kept and capitalized by setting the
By default, this parameter is true.
optional parameter +capitalize+ to false.
The capitalization of the first word can be turned off by setting the
Like +titleize+, this is meant for creating pretty output.
trailing '_id' if present.
Capitalizes the first word, turns underscores into spaces, and (by default) strips a
def humanize(capitalize: true, keep_id_suffix: false) ActiveSupport::Inflector.humanize(self, capitalize: capitalize, keep_id_suffix: keep_id_suffix) end