'Updating a gem having issues with zeitwerk

I'm trying to update this gem to work with rails 7 and I think that the error is due to zeitwerk. The error that's popping up is the following

/Users/nate/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/impressionist-2.0.0/lib/impressionist/engine.rb:15:in `block (2 levels) in <class:Engine>': uninitialized constant Impressionist::Engine::ImpressionistController (NameError)

and It's originating from lib/impressionist/engine.rb here from the lines below

module Impressionist
  class Engine < ::Rails::Engine
    attr_accessor :orm

  initializer 'impressionist.model' do |app|
    @orm = Impressionist.orm
    include_orm
  end


  initializer 'impressionist.controller' do
    require "impressionist/controllers/mongoid/impressionist_controller" if orm == :mongoid.to_s

    ActiveSupport.on_load(:action_controller) do
     include ImpressionistController::InstanceMethods <--- HERE
     extend ImpressionistController::ClassMethods <--- HERE
   end
  end


 private

    def include_orm
      require "#{root}/app/models/impressionist/impressionable.rb"
      require "impressionist/models/#{orm}/impression.rb"
      require "impressionist/models/#{orm}/impressionist/impressionable.rb"
    end

  end
end

I think that this first include is trying to call app/controllers/impressionist_controller.rb, but for some reason doesn't load with rails 7. Any ideas on how to approach fixing this? I suspect that I have to somehow incorporate zeitwerk here.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source