Sha256: ca656cb60a10f1d7728fcb5fd87ccbc3983b7bf2971fa5935f4862e5c586fafb
Contents?: true
Size: 614 Bytes
Versions: 16
Compression:
Stored size: 614 Bytes
Contents
# encoding: utf-8 module SexyValidations module Validators class Length def self.validate(model, attribute, value, options) return unless value unless options.is_a?(Hash) options = { :within => options, } end min = options[:within].min if value.length < min model.errors.add(attribute, "zu kurz (mindestens #{min} Zeichen)") end max = options[:within].max if value.length > max model.errors.add(attribute, "zu lang (maximal #{max} Zeichen)") end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems