infusionvlc/ConexionFelina

View on GitHub
app/validators/treatment_entry_validator.rb

Summary

Maintainability
A
0 mins
Test Coverage
class TreatmentEntryValidator < ActiveModel::Validator
  MAXIMUM_CHARACTERS = 1024

  def validate(record)
    if !record.date.nil? && record.date > Date.today
      record.errors[:date] << " date must be in the past"
    end
  end
end