Permalink
Browse files

Merge pull request #9784 from vipulnsward/change_from_blank_to_empty_…

…on_string

Change from blank? to empty? on obvious string values  to save extra calls
  • Loading branch information...
2 parents 4620bdc + 9ff33fb commit 9c4c05fc82e997b722dec4068c3aa27eaee69eb8 @carlosantoniodasilva carlosantoniodasilva committed Mar 18, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/connection_adapters/column.rb
@@ -161,7 +161,7 @@ def binary_to_string(value)
def value_to_date(value)
if value.is_a?(String)
- return nil if value.blank?
+ return nil if value.empty?
fast_string_to_date(value) || fallback_string_to_date(value)
elsif value.respond_to?(:to_date)
value.to_date
@@ -172,14 +172,14 @@ def value_to_date(value)
def string_to_time(string)
return string unless string.is_a?(String)
- return nil if string.blank?
+ return nil if string.empty?
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.blank?
+ return nil if string.empty?
dummy_time_string = "2000-01-01 #{string}"
@@ -192,7 +192,7 @@ def string_to_dummy_time(string)
# convert something to a boolean
def value_to_boolean(value)
- if value.is_a?(String) && value.blank?
+ if value.is_a?(String) && value.empty?
nil
else
TRUE_VALUES.include?(value)

0 comments on commit 9c4c05f

Please sign in to comment.