Sha256: 3ba905335f226916f6997139e309c1595d12f4651e7ed863c5bb5779234eddb1
Contents?: true
Size: 424 Bytes
Versions: 9
Compression:
Stored size: 424 Bytes
Contents
module BusinessFlow # Validate that a given value is not nil, but allow blank/empty values. class NotNilValidator < ActiveModel::EachValidator # :reek:NilCheck :reek:UtilityFunction # Dear reek -- I didn't decided the ActiveModel Validator API, I just # have to live with it. def validate_each(record, attribute, value) record.errors[attribute] << 'must not be nil' if value.nil? end end end
Version data entries
9 entries across 9 versions & 1 rubygems