My favorite thing I've learned recently is something I learned when needing to remove a bunch of records that had just been created in a Rails app.

If you want to get all the records of model Post created on the current day, you can do:

Post.where(created_at: Time.current.all_day)

An alternative is


but the Time.current.all_day version is so simple!

Thanks to this StackOverflow post for the solution!