class ActiveModel::BlockValidator
:nodoc:
and call this block for each attribute being validated. validates_each
uses this validator.BlockValidator
is a special EachValidator
which receives a block on initialization
def initialize(options, &block)
and call this block for each attribute being validated. +validates_each+ uses this validator.
+BlockValidator+ is a special +EachValidator+ which receives a block on initialization
def initialize(options, &block) @block = block super end
def validate_each(record, attribute, value)
def validate_each(record, attribute, value) @block.call(record, attribute, value) end