Commit 4e84492
Fix Time.new keyword arguments on JRuby 10 (#443)
* Fix Time.new with keyword arguments on JRuby 10 and Ruby 3.1+
Replace `ruby2_keywords` approach with explicit `**kwargs` in
`new_with_mock_time`. On JRuby 10 (Ruby 3.4 compat), the
`ruby2_keywords` flag doesn't properly forward keyword arguments
through `new_without_mock_time`, causing `TypeError: no implicit
conversion of Hash into Integer` when ActiveModel deserializes
datetime columns.
The fix uses explicit `**kwargs` which works correctly across all
Ruby versions and implementations.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* replaced rescue ArgumentError with skip + version guard. This ensures a TypeError (or any other error) on older Ruby won't silently mask a failure. Also new test covering kwargs only, no positional args), which exercises the args.empty? && kwargs.any? branch
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Josh Cronemeyer <joshuacronemeyer@gmail.com>1 parent b06405e commit 4e84492
2 files changed
Lines changed: 34 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | | - | |
26 | | - | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
522 | 548 | | |
523 | 549 | | |
524 | 550 | | |
| |||
0 commit comments