Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change from blank? to empty? on obvious string values to save extra m…

…ethod calls
  • Loading branch information...
commit 9ff33fbec32e3f0692601bcd1895b8498df7883e 1 parent 4e7292c
@vipulnsward vipulnsward authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/connection_adapters/column.rb
View
8 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)
Please sign in to comment.
Something went wrong with that request. Please try again.