between in sql ruby code example Example: how to use between in active record Client.where(created_at: (Time.now.midnight - 1.day)..Time.now.midnight)