I swear I've read the docs and I think I have a basic understanding of the principles, but I can't for the life of me figure out where I'm loading these constants inappropriately.
I'm working to upgrade an app that was originally Rails 5.2
I'm getting this warning when I run RSpec, a server, a local console, etc.
DEPRECATION WARNING: Initialization autoloaded the constants ApplicationHelper, EventsHelper, FontAwesome::Rails::IconHelper, DeviseHelper, ErrorHandler, and ApplicationController.
Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.
Here are the constants that are being inappropriately autoloaded:
- ApplicationHelper - standard Rails file
- EventsHelper - standard Rails file for EventsController
- FontAwesome::Rails::IconHelper - from a gem, not in my app directory
- DeviseHelper - from a gem, not in my app directory
- ErrorHandler - Located at 'app/controllers/concerns/error_handler'
- ApplicationController - standard Rails file
I've looked for instances where I might be calling include
or require
for these constants, but found none. I especially focused on my initializers.
I've run (and read through) bin/rails zeitwerk:check
without any obvious hints. I see these instances getting loaded as expected:
...
Zeitwerk@rails.main: constant ApplicationHelper loaded from file /Users/ckragt/ruby/filterbuildscheduler/app/helpers/application_helper.rb
...
Zeitwerk@rails.main: constant EventsHelper loaded from file /Users/ckragt/ruby/filterbuildscheduler/app/helpers/events_helper.rb
...
Zeitwerk@rails.main: constant FontAwesome::Rails::IconHelper loaded from file /Users/ckragt/.rvm/gems/ruby-2.7.0/gems/font-awesome-rails-4.7.0.7/app/helpers/font_awesome/rails/icon_helper.rb
...
Zeitwerk@rails.main: constant DeviseHelper loaded from file /Users/ckragt/.rvm/gems/ruby-2.7.0/gems/devise-4.7.3/app/helpers/devise_helper.rb
...
Zeitwerk@rails.main: constant ErrorHandler loaded from file /Users/ckragt/ruby/filterbuildscheduler/app/controllers/concerns/error_handler.rb
...
Zeitwerk@rails.main: autoload set for ApplicationController, to be loaded from /Users/ckragt/ruby/filterbuildscheduler/app/controllers/application_controller.rb
I am using Spring and Binstub (both updated to latest versions).
Here's the top of my application.rb
file:
# frozen_string_literal: true
require_relative 'boot'
require 'csv'
require 'rails'
# Pick the frameworks you want:
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
# require "active_storage/engine"
require 'action_controller/railtie'
require 'action_mailer/railtie'
# require 'action_mailbox/engine'
# require 'action_text/engine'
require 'action_view/railtie'
# require 'action_cable/engine'
require 'sprockets/railtie'
# require 'rails/test_unit/railtie'
require 'google/apis/gmail_v1'
require 'google/api_client/client_secrets'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module BuildPlanner
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
...
Any ideas of where else I should look?