Skip to content

Commit acdd5ba

Browse files
author
Rob Widmer
committed
Another test fix and don't break Time strings when a precision hasn't been specified
1 parent d0365b8 commit acdd5ba

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/active_record/connection_adapters/sqlserver/type/time.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def serialize(value)
2020

2121
# Currently only called from our custom Time type for formatting
2222
def _formatted(value)
23+
return "#{value.to_s(:_sqlserver_time)}" unless precision
2324
"#{value.to_s(:_sqlserver_time)}.#{quote_fractional(value)}"
2425
end
2526

test/cases/showplan_test_sqlserver.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ class ShowplanTestSQLServer < ActiveRecord::TestCase
55

66
fixtures :cars
77

8+
# For some reason the default max width truncates values that we are looking for in jruby
9+
ActiveRecord::ConnectionAdapters::SQLServer::Showplan::PrinterTable.max_column_width = 500 if defined? JRUBY_VERSION
10+
811
describe 'Unprepare previously prepared SQL' do
912

1013
it 'from simple statement' do

0 commit comments

Comments
 (0)