# File lib/dm-validations/contextual_validators.rb, line 188 def execute(named_context, target) target.errors.clear! available_validators = context(named_context) executable_validators = available_validators.select { |v| v.execute?(target) } # In the case of a new Resource or regular ruby class instance, # everything needs to be validated completely, and no eager-loading # logic should apply. # if target.kind_of?(DataMapper::Resource) && !target.new? load_validated_properties(target, executable_validators) end executable_validators.map { |validator| validator.call(target) }.all? end