diff options
author | Xavier Noria <fxn@hashref.com> | 2010-02-28 22:28:58 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-02-28 22:28:58 +0100 |
commit | 68dd44cc62062c8f3c82dde678bf99e8f2245bb5 (patch) | |
tree | 19d0e7505f8905c7997e8f2d9a917e2f290e945d /railties/guides/source | |
parent | f3a7f0e028c72ed5e38e3eed9369d339addd3c19 (diff) | |
download | rails-68dd44cc62062c8f3c82dde678bf99e8f2245bb5.tar.gz rails-68dd44cc62062c8f3c82dde678bf99e8f2245bb5.tar.bz2 rails-68dd44cc62062c8f3c82dde678bf99e8f2245bb5.zip |
AS guide: documents String#pluralize
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 278d27ec67..b3e4bc778a 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1249,6 +1249,22 @@ The call +str.last(n)+ is equivalent to +str.from(-n)+ if +n+ > 0, and returns a NOTE: Defined in +active_support/core_ext/string/access.rb+. +h4. Inflections + +h5. +pluralize+ + +The method +pluralize+ returns the plural of its receiver: + +<ruby> +"table".pluralize # => "tables" +"ruby".pluralize # => "rubies" +"equipment".pluralize # => "equipment" +</ruby> + +As the previous example shows, Active Support knows some irregular plurals and a few uncountable nouns. Builtin rules can be extended in +config/initializers/inflections.rb+. That file is generated by the +rails+ command and has instructions in comments. + +NOTE: Defined in +active_support/core_ext/string/inflections.rb+. + h3. Extensions to +Numeric+ h4. Bytes |