Proof of Concept: A Hanami slice in a Rails app

To follow up on the solution to making sure Hanami doesn’t try to load files from app, A hanami slice in a Rails app - #4 by cllns

I suggested

  class App < Hanami::App
    prepare_container do |container|
      container.autoloader.ignore("app")
    end
  end

I think a better approach would be:

  class App < Hanami::App
    config.no_auto_register_paths << "app"
  end

This should accomplish the same thing, by keeping Hanami’s registration code out of that folder altogether, instead of just instructing zeitwerk to ignore that folder.

With the original approach I gave, there are keys for Rails components in Hanami.app.container (which it can’t load).

1 Like