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.
This commit is contained in:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user