Sha256: ca90cf40f0dd5c1953b1431189aea8497a92d75f31ae3024d64f62418d2bdd21
Contents?: true
Size: 353 Bytes
Versions: 1
Compression:
Stored size: 353 Bytes
Contents
class VolumeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) value[:volumes_attributes].each do |_, attrs| if attrs["capacity"].to_s.empty? || /\A\d+G?\Z/.match(attrs["capacity"].to_s).nil? record.errors.add(attribute, _("Volume size #{attrs["capacity"]} is not valid")) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_kubevirt-0.1.5 | app/validators/volume_validator.rb |