File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
lib/active_record/connection_adapters Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change 11
22MASTER
33
4+ * Force a binary encoding on values coming in and out of those columns for ruby 1.9.
5+ Fixes ticket #33 [Jeroen Zwartepoorte]
6+
47* Using change_column will leave default if the type does not change or a new default
58 is not included. Fixes issue #22. [Ransom Briggs]
69
Original file line number Diff line number Diff line change @@ -54,10 +54,12 @@ def string_to_utf8_encoding(value)
5454 end
5555
5656 def string_to_binary ( value )
57+ value = value . dup . force_encoding ( Encoding ::BINARY ) if value . respond_to? ( :force_encoding )
5758 "0x#{ value . unpack ( "H*" ) [ 0 ] } "
5859 end
5960
6061 def binary_to_string ( value )
62+ value = value . dup . force_encoding ( Encoding ::BINARY ) if value . respond_to? ( :force_encoding )
6163 value =~ /[^[:xdigit:]]/ ? value : [ value ] . pack ( 'H*' )
6264 end
6365
You can’t perform that action at this time.
0 commit comments