Sha256: dd01734dab67a0ffd1f50d38c6ac1f856b6783a959be8f3ee2e6fd65e40c748f
Contents?: true
Size: 498 Bytes
Versions: 1
Compression:
Stored size: 498 Bytes
Contents
class VolumeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value[:volumes_attributes].present? value[:volumes_attributes].each do |_, attrs| if attrs.key?("capacity") and attrs.key?("storage_class") 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_kubevirt-0.1.7 | app/validators/volume_validator.rb |