class Veto::MaxLengthCheck
Public Instance Methods
check(attribute, value, errors, options={})
click to toggle source
# File lib/veto/checks/max_length_check.rb, line 3 def check(attribute, value, errors, options={}) max = options.fetch(:with) message = options.fetch(:message, :max_length) on = options.fetch(:on, attribute) if value.nil? || value.length > max errors.add(on, message, max) end end