humanize(lower_case_and_underscored_word, options = {}) public

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.

humanize('employee_salary')              # => "Employee salary"
humanize('author_id')                    # => "Author"
humanize('author_id', capitalize: false) # => "author"
Show source
Register or log in to add new notes.