aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-10-17 07:02:39 -0700
committerJosé Valim <jose.valim@gmail.com>2011-10-17 07:02:39 -0700
commit59d6df5c695bba671e5e670520f8c5afa5ad193e (patch)
tree641e67bb986d6d813249b0f2fda7b35a693398e8 /railties
parent8dffc62a9b957c91575f7c014f50806e86d64505 (diff)
parent4535191c61b496b1a5e9dc57624581753fa71497 (diff)
downloadrails-59d6df5c695bba671e5e670520f8c5afa5ad193e.tar.gz
rails-59d6df5c695bba671e5e670520f8c5afa5ad193e.tar.bz2
rails-59d6df5c695bba671e5e670520f8c5afa5ad193e.zip
Merge pull request #3151 from zenprogrammer/pluralize_without_count
Added include_count parameter to pluralize.
Diffstat (limited to 'railties')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile8
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index ecc25c4f1c..c04e49281e 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -1426,6 +1426,14 @@ The method +pluralize+ returns the plural of its receiver:
As the previous example shows, Active Support knows some irregular plurals and uncountable nouns. Built-in rules can be extended in +config/initializers/inflections.rb+. That file is generated by the +rails+ command and has instructions in comments.
++pluralize+ can also take an optional +count+ parameter. If <tt>count == 1</tt> the singular form will be returned. For any other value of +count+ the plural form will be returned:
+
+<ruby>
+"dude".pluralize(0) # => "dudes"
+"dude".pluralize(1) # => "dude"
+"dude".pluralize(2) # => "dudes"
+</ruby>
+
Active Record uses this method to compute the default table name that corresponds to a model:
<ruby>