Skip to content

Commit 111611b

Browse files
Revert "Merge pull request rails#9784 from vipulnsward/change_from_blank_to_empty_on_string"
This reverts commit 9c4c05f, reversing changes made to 4620bdc. Reason: They're not completely interchangeable, since blank? will also check for strings containing spaces.
1 parent 9c4c05f commit 111611b

File tree

1 file changed

+4
-4
lines changed
  • activerecord/lib/active_record/connection_adapters

1 file changed

+4
-4
lines changed

activerecord/lib/active_record/connection_adapters/column.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def binary_to_string(value)
161161

162162
def value_to_date(value)
163163
if value.is_a?(String)
164-
return nil if value.empty?
164+
return nil if value.blank?
165165
fast_string_to_date(value) || fallback_string_to_date(value)
166166
elsif value.respond_to?(:to_date)
167167
value.to_date
@@ -172,14 +172,14 @@ def value_to_date(value)
172172

173173
def string_to_time(string)
174174
return string unless string.is_a?(String)
175-
return nil if string.empty?
175+
return nil if string.blank?
176176

177177
fast_string_to_time(string) || fallback_string_to_time(string)
178178
end
179179

180180
def string_to_dummy_time(string)
181181
return string unless string.is_a?(String)
182-
return nil if string.empty?
182+
return nil if string.blank?
183183

184184
dummy_time_string = "2000-01-01 #{string}"
185185

@@ -192,7 +192,7 @@ def string_to_dummy_time(string)
192192

193193
# convert something to a boolean
194194
def value_to_boolean(value)
195-
if value.is_a?(String) && value.empty?
195+
if value.is_a?(String) && value.blank?
196196
nil
197197
else
198198
TRUE_VALUES.include?(value)

0 commit comments

Comments
 (0)