class

String

v3.0.9 - Show latest stable - Superclass: Object

String inflections define new methods on the String class to transform names for different purposes. For instance, you can figure out the name of a database from the name of a class.

"ScaleScore".tableize # => "scale_scores"

Files

  • activesupport/lib/active_support/core_ext/object/blank.rb
  • activesupport/lib/active_support/core_ext/string/access.rb
  • activesupport/lib/active_support/core_ext/string/behavior.rb
  • activesupport/lib/active_support/core_ext/string/conversions.rb
  • activesupport/lib/active_support/core_ext/string/encoding.rb
  • activesupport/lib/active_support/core_ext/string/exclude.rb
  • activesupport/lib/active_support/core_ext/string/filters.rb
  • activesupport/lib/active_support/core_ext/string/inflections.rb
  • activesupport/lib/active_support/core_ext/string/multibyte.rb
  • activesupport/lib/active_support/core_ext/string/output_safety.rb
  • activesupport/lib/active_support/core_ext/string/starts_ends_with.rb
  • activesupport/lib/active_support/core_ext/string/strip.rb
  • activesupport/lib/active_support/core_ext/string/xchar.rb
  • activesupport/lib/active_support/json/encoding.rb

1Note

constantize

eric_programmer ยท Jan 14, 20092 thanks

@ncancelliere - Instead use constantize which is provided as part of ActiveSupport. It is much easier. So:

mystring.constantize