File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ module Jdbc
66 # @private Simply to quickly "hack-in" 4.2 compatibility.
77 module TypeCast
88
9- TRUE_VALUES = Column ::TRUE_VALUES
9+ TRUE_VALUES = Column ::TRUE_VALUES if Column . const_defined? ( :TRUE_VALUES )
1010 FALSE_VALUES = Column ::FALSE_VALUES
1111
1212 #module Format
@@ -58,7 +58,16 @@ def value_to_boolean(value)
5858 else
5959 TRUE_VALUES . include? ( value )
6060 end
61- end
61+ end if const_defined? ( :TRUE_VALUES ) # removed on AR 5.0
62+
63+ # convert something to a boolean
64+ def value_to_boolean ( value )
65+ if value . is_a? ( String ) && value . empty?
66+ nil
67+ else
68+ ! FALSE_VALUES . include? ( value )
69+ end
70+ end unless const_defined? ( :TRUE_VALUES )
6271
6372 # Used to convert values to integer.
6473 # handle the case when an integer column is used to store boolean values
You can’t perform that action at this time.
0 commit comments