Commit 5593aff
Prefer activerecord_class.default_timezone when available
Schema#default_timezone read the global ActiveRecord.default_timezone
(or ActiveRecord::Base.default_timezone for AR < 7.0) unconditionally,
ignoring the configured @connection.activerecord_class. If a caller
wired plsql up with an ActiveRecord subclass that overrides
default_timezone, the override was silently dropped.
Check the connection's activerecord_class first and call
default_timezone on it when the class responds to it. AR 5.x – 7.x
expose default_timezone on ActiveRecord::Base (and therefore on all
subclasses), which honors any subclass override. AR 8.0 removed the
class-level accessor, so in that case fall back to the module-level
ActiveRecord.default_timezone.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f4aa7ab commit 5593aff
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
0 commit comments