-
Notifications
You must be signed in to change notification settings - Fork 387
Open
Description
Rails 7.2 has stopped doing binding replacement at the code level, which has introduced an issue when bindings have a timezone.
Ruby
Workflow.where("effective_date <= ?", Time.current).last
SELECT "workflows".* FROM "workflows" WHERE (effective_date <= $1) ORDER BY "workflows"."id" DESC LIMIT $2 [[nil, "2025-09-18 03:11:44.998672"], ["LIMIT", 1]
JRuby
Workflow.where("effective_date <= ?", Time.current).last
Workflow Load (109.1ms) SELECT "workflows".* FROM "workflows" WHERE (effective_date <= ?) ORDER BY "workflows"."id" DESC LIMIT ? [[nil, Tue, 09 Sep 2025 15:02:41.133000000 AEST +10:00], ["LIMIT", 1]]
This test was added internally for a different fork.
def test_time_bind_param
with_timezone_config default: :utc, zone: 'Australia/Melbourne' do
time = Time.zone.local(2000, 1, 1, 16)
entry = Entry.create! updated_on: time + 1.hour
sql = 'updated_on >= ?'
entries = Entry.where(sql, time)
assert_equal 1, entries.size
end
end
Metadata
Metadata
Assignees
Labels
No labels