AgileVentures/osra

View on GitHub
app/models/validators/date_not_in_future_validator.rb

Summary

Maintainability
A
0 mins
Test Coverage
class DateNotInFutureValidator < ActiveModel::EachValidator
  include DateHelpers

  def validate_each(record, attribute, value)
    if valid_date?(value) && value.future?
      record.errors[attribute] << ('is not valid (cannot be in the future)')
    end
  end

end