aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/active_support_core_extensions.textile
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-07-20 12:17:01 +0200
committerXavier Noria <fxn@hashref.com>2011-07-20 12:17:37 +0200
commit0e6f19cc9bbad22543223550afb3e321309fe07f (patch)
treeae68e49aa8d4f47c5e4d5ba308c4bad9bdaf52a6 /railties/guides/source/active_support_core_extensions.textile
parente175117eaff267badfa6000382cdfd1a85eef945 (diff)
downloadrails-0e6f19cc9bbad22543223550afb3e321309fe07f.tar.gz
rails-0e6f19cc9bbad22543223550afb3e321309fe07f.tar.bz2
rails-0e6f19cc9bbad22543223550afb3e321309fe07f.zip
documents the changes to String#blank? in the AS guide
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile4
1 files changed, 3 insertions, 1 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index a0ed85cf01..b35e04d7e1 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -78,12 +78,14 @@ The following values are considered to be blank in a Rails application:
* +nil+ and +false+,
-* strings composed only of whitespace, i.e. matching +/\A\s*\z/+,
+* strings composed only of whitespace (see note below),
* empty arrays and hashes, and
* any other object that responds to +empty?+ and it is empty.
+INFO: In Ruby 1.9 the predicate for strings uses the Unicode-aware character class <tt>[:space:]</tt>, so for example U+2029 (paragraph separator) is considered to be whitespace. In Ruby 1.8 whitespace is considered to be <tt>\s</tt> together with the ideographic space U+3000.
+
WARNING: Note that numbers are not mentioned, in particular 0 and 0.0 are *not* blank.
For example, this method from +ActionDispatch::Session::AbstractStore+ uses +blank?+ for checking whether a session key is present: