app/models/announcement.rb
def ends_in_the_future
    return unless end_at.present? && Time.current > end_at

    errors.add(:end_at, 'must be in the future')
  end
# Validates the end_at time is in the future
# (otherwise what is the point of adding it when it would never display)
#
Validates the end_at time is in the future
(otherwise what is the point of adding it when it would never display)
Validates the end_at time is in the future ( otherwise what is the point of adding it when it would never display )
def ends_in_the_future
    return unless end_at.present? && Time.current > end_at
    errors.add(:end_at, 'must be in the future')
  end
def ends_in_the_future return unless end_at . present? && Time . current > end_at errors . add ( :end_at , 'must be in the future' ) end
Validates the end_at time is in the future
(otherwise what is the point of adding it when it would never display)
Validates the end_at time is in the future ( otherwise what is the point of adding it when it would never display )