Skip to content

Commit 8fb83a8

Browse files
committed
Fix context "with a DateTime" should "return an ISO 8601 datetime string" test failure.
1 parent e9c5290 commit 8fb83a8

File tree

1 file changed

+10
-10
lines changed
  • lib/active_record/connection_adapters/sqlserver

1 file changed

+10
-10
lines changed

lib/active_record/connection_adapters/sqlserver/quoting.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ module ActiveRecord
22
module ConnectionAdapters
33
module Sqlserver
44
module Quoting
5-
5+
66
QUOTED_TRUE, QUOTED_FALSE = '1', '0'
77
QUOTED_STRING_PREFIX = 'N'
8-
8+
99
def quote(value, column = nil)
1010
case value
1111
when String, ActiveSupport::Multibyte::Chars
@@ -32,11 +32,11 @@ def quote(value, column = nil)
3232
super
3333
end
3434
end
35-
35+
3636
def quoted_string_prefix
3737
QUOTED_STRING_PREFIX
3838
end
39-
39+
4040
def quote_string(string)
4141
string.to_s.gsub(/\'/, "''")
4242
end
@@ -48,7 +48,7 @@ def quote_column_name(name)
4848
def quote_table_name(name)
4949
quote_column_name(name)
5050
end
51-
51+
5252
def substitute_at(column, index)
5353
if column.respond_to?(:sql_type) && column.sql_type == 'timestamp'
5454
nil
@@ -69,15 +69,15 @@ def quoted_datetime(value)
6969
if value.acts_like?(:time)
7070
time_zone_qualified_value = quoted_value_acts_like_time_filter(value)
7171
if value.is_a?(Date)
72-
time_zone_qualified_value.to_time.xmlschema.to(18)
72+
time_zone_qualified_value.iso8601(3).to(18)
7373
else
7474
time_zone_qualified_value.iso8601(3).to(22)
7575
end
7676
else
7777
quoted_date(value)
7878
end
7979
end
80-
80+
8181
def quoted_full_iso8601(value)
8282
if value.acts_like?(:time)
8383
value.is_a?(Date) ? quoted_value_acts_like_time_filter(value).to_time.xmlschema.to(18) : quoted_value_acts_like_time_filter(value).iso8601(7).to(22)
@@ -95,14 +95,14 @@ def quoted_date(value)
9595
super
9696
end
9797
end
98-
98+
9999
protected
100-
100+
101101
def quoted_value_acts_like_time_filter(value)
102102
zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal
103103
value.respond_to?(zone_conversion_method) ? value.send(zone_conversion_method) : value
104104
end
105-
105+
106106
end
107107
end
108108
end

0 commit comments

Comments
 (0)