Fix milestone publication date comparison

We're storing the publication date as datetime in the database, and we
were comparing it to a date, meaning today's milestones were not being
found.
This commit is contained in:
Javi Martín
2019-10-10 02:21:34 +02:00
parent 0f2a96979e
commit 6a6a8bf365
2 changed files with 10 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ class Milestone < ApplicationRecord
validates_translation :description, presence: true, unless: -> { status_id.present? }
scope :order_by_publication_date, -> { order(publication_date: :asc, created_at: :asc) }
scope :published, -> { where("publication_date <= ?", Date.current) }
scope :published, -> { where("publication_date <= ?", Date.current.end_of_day) }
scope :with_status, -> { where("status_id IS NOT NULL") }
def self.title_max_length