File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
lib/active_record/connection_adapters/sqlserver/type Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ def type
88 :char
99 end
1010
11+ def type_cast_for_database ( value )
12+ return if value . nil?
13+ return value if value . is_a? ( Data )
14+ Data . new ( super )
15+ end
16+
1117 class Data
1218
1319 def initialize ( value )
Original file line number Diff line number Diff line change @@ -120,6 +120,9 @@ def quoted_id
120120 data = ActiveRecord ::Type ::SQLServer ::Char ::Data
121121 assert_sql ( /@0 = 'T'/ ) { SSTestDatatypeMigration . where ( char_col : data . new ( 'T' ) ) . first }
122122 assert_sql ( /@0 = 'T'/ ) { SSTestDatatypeMigration . where ( varchar_col : data . new ( 'T' ) ) . first }
123+ # Taking care of everything.
124+ assert_sql ( /@0 = 'T'/ ) { SSTestDatatypeMigration . where ( char_col : 'T' ) . first }
125+ assert_sql ( /@0 = 'T'/ ) { SSTestDatatypeMigration . where ( varchar_col : 'T' ) . first }
123126 end
124127
125128 # With column names that have spaces
You can’t perform that action at this time.
0 commit comments