diff options
author | Xavier Noria <fxn@hashref.com> | 2013-11-06 13:17:31 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-11-06 13:17:31 -0800 |
commit | f8e5022c73679f41db9bb6743179bab4571fb28e (patch) | |
tree | 63356431e4898a820f8f8ff8f7103b2f2c36dba7 /guides | |
parent | 256ae7dec5626620eb5a064f50931e1d9317b2a4 (diff) | |
parent | c61544c7818f109c132fcad9db73d43216417535 (diff) | |
download | rails-f8e5022c73679f41db9bb6743179bab4571fb28e.tar.gz rails-f8e5022c73679f41db9bb6743179bab4571fb28e.tar.bz2 rails-f8e5022c73679f41db9bb6743179bab4571fb28e.zip |
Merge pull request #12789 from claudiob/humanize-without-capitalizing
Add +capitalize+ option to Inflector.humanize
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 0370e40012..b72ebd63ee 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -1772,6 +1772,12 @@ The method `humanize` gives you a sensible name for display out of an attribute "comments_count".humanize # => "Comments count" ``` +The capitalization of the first word can be turned off by setting the optional parameter `capitalize` to false: + +```ruby +"author_id".humanize(capitalize: false) # => "author" +``` + The helper method `full_messages` uses `humanize` as a fallback to include attribute names: ```ruby |