mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert "Merge pull request #9784 from vipulnsward/change_from_blank_to_empty_on_string"
This reverts commit9c4c05fc82
, reversing changes made to4620bdcefd
. Reason: They're not completely interchangeable, since blank? will also check for strings containing spaces.
This commit is contained in:
parent
9c4c05fc82
commit
111611b511
1 changed files with 4 additions and 4 deletions
|
@ -161,7 +161,7 @@ module ActiveRecord
|
||||||
|
|
||||||
def value_to_date(value)
|
def value_to_date(value)
|
||||||
if value.is_a?(String)
|
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)
|
fast_string_to_date(value) || fallback_string_to_date(value)
|
||||||
elsif value.respond_to?(:to_date)
|
elsif value.respond_to?(:to_date)
|
||||||
value.to_date
|
value.to_date
|
||||||
|
@ -172,14 +172,14 @@ module ActiveRecord
|
||||||
|
|
||||||
def string_to_time(string)
|
def string_to_time(string)
|
||||||
return string unless string.is_a?(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)
|
fast_string_to_time(string) || fallback_string_to_time(string)
|
||||||
end
|
end
|
||||||
|
|
||||||
def string_to_dummy_time(string)
|
def string_to_dummy_time(string)
|
||||||
return string unless string.is_a?(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}"
|
dummy_time_string = "2000-01-01 #{string}"
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ module ActiveRecord
|
||||||
|
|
||||||
# convert something to a boolean
|
# convert something to a boolean
|
||||||
def value_to_boolean(value)
|
def value_to_boolean(value)
|
||||||
if value.is_a?(String) && value.empty?
|
if value.is_a?(String) && value.blank?
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
TRUE_VALUES.include?(value)
|
TRUE_VALUES.include?(value)
|
||||||
|
|
Loading…
Reference in a new issue