fxn/zeitwerk

Expected file ... to define ..

Closed this issue · 2 comments

Hello!

I am upgrading my rails app from 5.2.6 to 6, and currently I am trying to enable zeitwerk as the default loader.

But I am running into a host of issues when running: rails zeitwerk: check. FIles under the jobs, tasks and other subfolders give this error: expected file app/jobs/webhook/mail_delivery_job.rb to define constant Webhook::MailDeliveryJob.

I can continue adding these folders/files to the config.autoload_paths and config.eager_load_paths, but they just build up, and that seems like it can't be true.

If I run ActiveSupport::Dependencies.autoload_paths, it also lists all those folders (app/app/jobs, app/app/tasks), so I am confused why these errors are happening. If I add them, the errors disappears.

I hope this is the right place to ask for help!

I might have misunderstood the issue, it's been a long day.

It actually tells me what to do, the class constant is not correct compared to what Zeitwerk expects.

Nevermind me!

fxn commented

Hey! Would you like to share more details? Maybe I can help you migrate without renaming a ton of things.

In this case, what is app/jobs/webhook/mail_delivery_job.rb defining?