Sha256: e187e31b7942385ed4cfabef54d42a461b4391b9c8d5639dfa2fd2c766dbd45b
Contents?: true
Size: 255 Bytes
Versions: 4
Compression:
Stored size: 255 Bytes
Contents
class AllowedTypeValidator < ActiveModel::EachValidator def validate_each(record, name, value) if options[:in].find { |klass| value.is_a?(klass) }.nil? record.errors[name] << "does not have the expected type #{options[:in]}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems