You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: nested_validator.rb
    path of file: ./repos/MiniForm/lib/mini_form
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'active_model'

module MiniForm
  class NestedValidator < ActiveModel::EachValidator
    def validate_each(record, _, relation)
      return if relation.valid?

      if record.errors.respond_to?(:merge!)
        # Rails 6.1+ where accessing
    
    def validate_each(record, _, relation)
      return if relation.valid?

      if record.errors.respond_to?(:merge!)
        # Rails 6.1+ where accessing ActiveModel::Errors as a hash has been
        # deprecated and the errors array is frozen. For this reason we use the new
        # method merge!() which appends the errors as NestedErrors to the array. "This is the way."
        record.errors.merge!(relation.errors)
        return
      end