instance method singularize

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

singularize()

The reverse of pluralize, returns the singular form of a word in a string.

"posts".singularize            # => "post"
"octopi".singularize           # => "octopus"
"sheep".singularize            # => "sheep"
"word".singularize             # => "word"
"the blue mailmen".singularize # => "the blue mailman"
"CamelOctopi".singularize      # => "CamelOctopus"
Source
# File activesupport/lib/active_support/core_ext/string/inflections.rb, line 31
        def singularize
          Inflector.singularize(self)
        end

Defined in activesupport/lib/active_support/core_ext/string/inflections.rb line 31 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::CoreExtensions::String::Inflections

Type at least 2 characters to search.

↑↓ navigate · open · esc close