Module ActiveSupport::CoreExtensions::String::Inflections
In: vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb

Makes it possible to do "posts".singularize that returns "post" and "MegaCoolClass".underscore that returns "mega_cool_class".

Methods

Public Instance methods

camelcase(first_letter = :upper)

Alias for camelize

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 15
15:         def camelize(first_letter = :upper)
16:           case first_letter
17:             when :upper then Inflector.camelize(self, true)
18:             when :lower then Inflector.camelize(self, false)
19:           end
20:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 44
44:         def classify
45:           Inflector.classify(self)
46:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 58
58:         def constantize
59:           Inflector.constantize(self)
60:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 32
32:         def dasherize
33:           Inflector.dasherize(self)
34:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 36
36:         def demodulize
37:           Inflector.demodulize(self)
38:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 54
54:         def foreign_key(separate_class_name_and_id_with_underscore = true)
55:           Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)
56:         end

Capitalizes the first word and turns underscores into spaces and strips _id, so "employee_salary" becomes "Employee salary" and "author_id" becomes "Author".

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 50
50:         def humanize
51:           Inflector.humanize(self)
52:         end

[Source]

   # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 7
7:         def pluralize
8:           Inflector.pluralize(self)
9:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 11
11:         def singularize
12:           Inflector.singularize(self)
13:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 40
40:         def tableize
41:           Inflector.tableize(self)
42:         end
titlecase()

Alias for titleize

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 23
23:         def titleize
24:           Inflector.titleize(self)
25:         end

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb, line 28
28:         def underscore
29:           Inflector.underscore(self)
30:         end

[Validate]