Sha256: c2d491bfb53d32cd3b03c0da9274885e5b69cde6934db1b3838c82464f102273
Contents?: true
Size: 438 Bytes
Versions: 35
Compression:
Stored size: 438 Bytes
Contents
module ActiveModel module Validations class RespondToValidator < EachValidator RESERVED_OPTIONS = [:if, :unless] def validate_each(record,attribute,value) responders = options.dup RESERVED_OPTIONS.each do |opt,should_apply| responders.delete(opt) end responders.each do |method,dummy| record.errors.add(attribute) unless value.respond_to? method end end end end end
Version data entries
35 entries across 35 versions & 1 rubygems