From 3ba8b05cbb586b86ad53cc44c55bf2bce1a33475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 21 Jun 2019 00:28:57 +0200 Subject: [PATCH] Use `Date#all_day` in `DirectMessage.today` The method `Date#all_day` was added in Rails 5.1, and returns the same interval we were using while it makes the code simple. --- app/models/direct_message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/direct_message.rb b/app/models/direct_message.rb index 16c676756..d40ca59cf 100644 --- a/app/models/direct_message.rb +++ b/app/models/direct_message.rb @@ -8,7 +8,7 @@ class DirectMessage < ApplicationRecord validates :receiver, presence: true validate :max_per_day - scope :today, lambda { where(created_at: Date.current.beginning_of_day..Date.current.end_of_day) } + scope :today, lambda { where(created_at: Date.current.all_day) } def max_per_day return if errors.any?