From 111611b511c27ec29be6a8837de6d8f25cded5a7 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Mon, 18 Mar 2013 18:46:48 -0300 Subject: [PATCH] Revert "Merge pull request #9784 from vipulnsward/change_from_blank_to_empty_on_string" This reverts commit 9c4c05fc82e997b722dec4068c3aa27eaee69eb8, reversing changes made to 4620bdcefd0c88905a005f191496df887877b8f3. Reason: They're not completely interchangeable, since blank? will also check for strings containing spaces. --- .../lib/active_record/connection_adapters/column.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index 609ccc2ed2..a4b3a0c584 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -161,7 +161,7 @@ module ActiveRecord def value_to_date(value) if value.is_a?(String) - return nil if value.empty? + return nil if value.blank? fast_string_to_date(value) || fallback_string_to_date(value) elsif value.respond_to?(:to_date) value.to_date @@ -172,14 +172,14 @@ module ActiveRecord def string_to_time(string) return string unless string.is_a?(String) - return nil if string.empty? + return nil if string.blank? fast_string_to_time(string) || fallback_string_to_time(string) end def string_to_dummy_time(string) return string unless string.is_a?(String) - return nil if string.empty? + return nil if string.blank? dummy_time_string = "2000-01-01 #{string}" @@ -192,7 +192,7 @@ module ActiveRecord # convert something to a boolean def value_to_boolean(value) - if value.is_a?(String) && value.empty? + if value.is_a?(String) && value.blank? nil else TRUE_VALUES.include?(value)