From b456877cfb7e0cb0bab9ffd5674abd23caba0ab4 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 22 Jul 2010 01:27:02 +0200 Subject: camelize and underscore are sort of inverse of each other, but not in a mathematical sense [#5174 state:resolved] --- railties/guides/source/active_support_core_extensions.textile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index a895dbded2..e53c7715bb 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1491,13 +1491,15 @@ end That may be handy to compute method names in a language that follows that convention, for example JavaScript. +INFO: As a rule of thumb you can think of +camelize+ as the inverse of +underscore+, though there are cases where that does not hold: "SSLError".underscore.camelize gives back "SslError". + +camelize+ is aliased to +camelcase+. NOTE: Defined in +active_support/core_ext/string/inflections.rb+. h5. +underscore+ -The method +underscore+ is the inverse of +camelize+, explained above: +The method +underscore+ goes the other way around, from camel case to paths: "Product".underscore # => "product" @@ -1530,6 +1532,8 @@ def load_missing_constant(from_mod, const_name) end +INFO: As a rule of thumb you can think of +underscore+ as the inverse of +camelize+, though there are cases where that does not hold. For example, "SSLError".underscore.camelize gives back "SslError". + NOTE: Defined in +active_support/core_ext/string/inflections.rb+. h5. +titleize+ -- cgit v1.2.3