Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeitwerk Issue on Rails 6.1 #210

Open
jarednorman opened this issue Apr 25, 2021 · 1 comment
Open

Zeitwerk Issue on Rails 6.1 #210

jarednorman opened this issue Apr 25, 2021 · 1 comment

Comments

@jarednorman
Copy link
Member

Someone reported an issue over here where the Spree::User model wasn't present when installing Solidus. It was solved by returning to the classic autoloader. This suggests to me that we may have an issue with Zeitwerk loading in recent versions.

I've not investigated this any further, but didn't want to forget so I opened this issue.

@mamhoff
Copy link
Contributor

mamhoff commented Jun 12, 2023

I'm likely running into a related issue: Currently (Solidus main as of solidusio/solidus@78d20c4, solidus_auth_devise version 2.5.8) the sandbox can't find the backend sessions controller. This is the error when you try:

Started GET "/admin/" for 127.0.0.1 at 2023-06-12 15:37:29 +0200
  ActiveRecord::SchemaMigration Pluck (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Processing by Spree::Admin::RootController#index as HTML
Redirected to http://localhost:3000/admin/login
Completed 302 Found in 340ms (ActiveRecord: 0.8ms | Allocations: 530212)


Started GET "/admin/login" for 127.0.0.1 at 2023-06-12 15:37:29 +0200
  
ActionController::RoutingError (uninitialized constant Spree::Admin::UserSessionsController

      Object.const_get(camel_cased_word)
            ^^^^^^^^^^
Did you mean?  UserPasswordsController

            raise MissingController.new(error.message, error.name)
            ^^^^^):
  
bin/rails zeitwerk:check

results in

Hold on, I am eager loading the application.

WARNING: The following directories will only be checked if you configure
them to be eager loaded:

  /home/anselm/.gem/ruby/3.1.4/gems/solidus_paypal_commerce_platform-1.0.1/app/decorators/models
  /home/anselm/.gem/ruby/3.1.4/gems/solidus_auth_devise-2.5.8/lib/decorators/backend/controllers
  /home/anselm/.gem/ruby/3.1.4/gems/solidus_auth_devise-2.5.8/lib/controllers/backend/spree

You may verify them manually, or add them to config.eager_load_paths
in config/application.rb and run zeitwerk:check again.

Otherwise, all is good!

So somewhere, maybe in engine.rb or in some other initializer, we need to add those paths to zeitwerks autoload_paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants