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: has_notifications.rb
    path of file: ./repos/noticed/lib/noticed
    
    the code of the file until where you have to start completion: module Noticed
  module HasNotifications
    # Defines a method for the association and a before_destroy callback to remove notifications
    # where this record is a param
    #
    #    class User < ApplicationRe
    
      def has_noticed_notifications(param_name: model_name.singular, **options)
        define_method :"notifications_as_#{param_name}" do
          model = options.fetch(:model_name, "Noticed::Event").constantize
          case current_adapter
          when "postgresql", "postgis"
            model.where("params @> ?", Noticed::Coder.dump(param_name.to_sym => self).to_json)
          when "mysql2", "trilogy"
            model.where("JSON_CONTAINS(params, ?)", Noticed::Coder.dump(param_name.to_sym => self).to_json)
          when "sqlite3"
            model.where("json_extract(params, ?) = ?", "$.#{param_name}", Noticed::Coder.dump(self).to_json)
          else
            # This will perform an exact match which isn't ideal
            model.where(params: {param_name.to_sym => self})
          end
        end