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: bytesize_validator.rb
    path of file: ./repos/gitlabhq/app/validators
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# BytesizeValidator
#
# Custom validator for verifying that bytesize of a field doesn't exceed the specified li
    
  def validate_each(record, attr, value)
    size = value.to_s.bytesize
    max_size = options[:maximum].call

    return if size <= max_size

    error_message = format(_('is too long (%{size}). The maximum size is %{max_size}.'), {
                             size: ActiveSupport::NumberHelper.number_to_human_size(size),
                             max_size: ActiveSupport::NumberHelper.number_to_human_size(max_size)
                           })

    record.errors.add(attr, error_message)
  end