AS guide: documents String#pluralize
This commit is contained in:
parent
f3a7f0e028
commit
68dd44cc62
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user