💎Rails tip: Infinite range queries

Sebastien Auriault
Jan 29, 2022
You can use infinite ranges with dates and numbers in your ActiveRecord queries.

Examples ⬇️

# Find all posts created in the last week
Post.where(created_at: 1.week.ago..)

# Find all posts having less than 10 likes
Post.where(likes: ..10)