Skip to content

Commit c95be82

Browse files
committed
Start letting superclasses do the work. Correctly implement #quoted_true and #quoted_false
1 parent 479a2ba commit c95be82

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ def sqlserver_2005?
334334
def quote(value, column = nil)
335335
return value.quoted_id if value.respond_to?(:quoted_id)
336336
case value
337-
when TrueClass then '1'
338-
when FalseClass then '0'
339337
when String, ActiveSupport::Multibyte::Chars
340338
value = value.to_s
341339
# for binary columns, don't quote the result of the string to binary
@@ -377,6 +375,14 @@ def quote_table_name(name)
377375
end
378376
end
379377

378+
def quoted_true
379+
'1'
380+
end
381+
382+
def quoted_false
383+
'0'
384+
end
385+
380386
# REFERENTIAL INTEGRITY ====================================#
381387
# TODO: Add #disable_referential_integrity if we can use it
382388

test/cases/adapter_test_sqlserver.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ def setup
5656

5757
context 'For Quoting' do
5858

59+
should 'return 1 for #quoted_true' do
60+
assert_equal '1', @connection.quoted_true
61+
end
62+
63+
should 'return 0 for #quoted_false' do
64+
assert_equal '0', @connection.quoted_false
65+
end
66+
5967
end
6068

6169
context 'For DatabaseStatements' do

0 commit comments

Comments
 (0)