Ruby's range literals and their effect on Rails Active Record queries
The following Active Record query:
User.where(created_at: 1.day.ago...Time.current).to_sql
will generate this SQL:
SELECT
"users".*
FROM
"users"
WHERE
"users"."created_at" >= '2023-06-21 06:38:26.330063'
AND
"users"."created_at" < '2023-0...
allaboutcoding.ghinda.com3 min read