Skip to content

Commit 3e1bf96

Browse files
committed
Fix mysql test failure to deprecated to_s(:db) method
Loading development environment (Rails 7.0.8.4) [1] pry(main)> t = Time.current => Thu, 25 Jul 2024 16:56:41.434382638 AEST +10:00 [2] pry(main)> [3] pry(main)> t.to_s(:db) DEPRECATION WARNING: TimeWithZone#to_s(:db) is deprecated. Please use TimeWithZone#to_fs(:db) instead. (called from require at bin/rails:4) => "2024-07-25 06:56:41"
1 parent e7bba82 commit 3e1bf96

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/db/mysql/simple_test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def test_time_usec_formatting_when_saved_into_string_column
2424
e = DbType.create!(:sample_string => '', :sample_text => '')
2525
t = Time.now
2626
value = Time.local(t.year, t.month, t.day, t.hour, t.min, t.sec, 0)
27-
if ActiveRecord::VERSION::MAJOR >= 3
27+
if ActiveRecord::VERSION::MAJOR >= 7
28+
str = value.utc.to_fs(:db)
29+
elsif ActiveRecord::VERSION::MAJOR >= 3
2830
str = value.utc.to_s(:db)
2931
else # AR-2.x #quoted_date did not do TZ conversions
3032
str = value.to_s(:db)

0 commit comments

Comments
 (0)