class Xeroizer::Record::Validator::LengthOfValidator
Public Instance Methods
valid?(record)
click to toggle source
# File lib/xeroizer/record/validators/length_of_validator.rb, line 8 def valid?(record) if options[:max] && record.attributes[attribute].to_s.length > options[:max] record.errors << [attribute, options[:message] || "must be shorter than #{options[:max]} characters"] end if options[:min] && record.attributes[attribute].to_s.length < options[:min] record.errors << [attribute, options[:message] || "must be greater than #{options[:min]} characters"] end end