Skip to content

Commit 27c193c

Browse files
authored
Fix casting of invalid time values (#1258)
1 parent f471cd4 commit 27c193c

File tree

1 file changed

+3
-2
lines changed
  • lib/active_record/connection_adapters/sqlserver/type

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ def quoted(value)
3636

3737
defcast_value(value)
3838
value=super
39-
returnifvalue.blank?
4039

41-
value=value.changeyear: 2000,month: 01,day: 01
40+
returnvalueunlessvalue.is_a?(::Time)
41+
42+
value=value.change(year: 2000,month: 01,day: 01)
4243
apply_seconds_precision(value)
4344
end
4445

0 commit comments

Comments
(0)