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: model_config.rb
    path of file: ./repos/paper_trail-association_tracking/lib/paper_trail_association_tracking
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module PaperTrailAssociationTracking
  # Configures an ActiveRecord model, mostly at application boot time, but also
  # sometimes
    
    def update_habtm_state(name, callback, model, assoc)
      model.paper_trail_habtm ||= {}
      model.paper_trail_habtm[name] ||= { removed: [], added: [] }
      state = model.paper_trail_habtm[name]
      assoc_id = assoc.id
      case callback
      when :before_add
        state[:added] |= [assoc_id]
        state[:removed] -= [assoc_id]
      when :before_remove
        state[:removed] |= [assoc_id]
        state[:added] -= [assoc_id]
      else
        raise "Invalid callback: #{callback}"
      end