blob: 77e7cfa4f6bcdc196735c602187a656a31e7763b (
plain)
1
2
3
4
5
6
7
8
9
|
# frozen_string_literal: true
class ShaValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if value.blank? || Commit.valid_hash?(value)
record.errors.add(attribute, 'is not a valid SHA')
end
end
|