instance method classify

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

classify()

Create a class name from a plural table name like Rails does for table names to models. Note that this returns a string and not a class. (To convert to an actual class follow classify with constantize.)

"egg_and_hams".classify # => "EggAndHam"
"posts".classify        # => "Post"

Singular names are not handled correctly.

"business".classify # => "Busines"
Source
# File activesupport/lib/active_support/core_ext/string/inflections.rb, line 129
        def classify
          Inflector.classify(self)
        end

Defined in activesupport/lib/active_support/core_ext/string/inflections.rb line 129 · 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