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: association.rb
    path of file: ./repos/nobrainer/lib/no_brainer/document
    
    the code of the file until where you have to start completion: module NoBrainer::Document::Association
  extend NoBrainer::Autoload
  autoload :Core, :BelongsTo, :HasMany, :HasMany
    
    def association_user_to_model_cast(key, value, target_class = nil)
      association = association_metadata[key]
      case association
      when NoBrainer::Document::Association::BelongsTo::Metadata
        association.cast_attr(key, value, target_class)
      else [key, value]
      end