instance method
pluralize
Ruby on Rails 3.0.20
Since v2.2.3Signature
pluralize(word)
Returns the plural form of the word in the string.
Examples:
"post".pluralize # => "posts" "octopus".pluralize # => "octopi" "sheep".pluralize # => "sheep" "words".pluralize # => "words" "CamelOctopus".pluralize # => "CamelOctopi"
Parameters
-
wordreq
Source
# File activesupport/lib/active_support/inflector/inflections.rb, line 129
def pluralize(word)
result = word.to_s.dup
if word.empty? || inflections.uncountables.include?(result.downcase)
result
else
inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
result
end
end
Defined in activesupport/lib/active_support/inflector/inflections.rb line 129
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Inflector