Class: EstimateValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/central/support/validators/estimate_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object

Checks that the estimate being validated is valid for record.project



3
4
5
6
7
8
9
# File 'lib/central/support/validators/estimate_validator.rb', line 3

def validate_each(record, attribute, value)
  if record.project
    unless record.project.point_values.include?(value)
      record.errors[attribute] << "is not an allowed value for this project"
    end
  end
end