rails: Upgrading Rails to v6-beta3 causes uninitialized constant ActionText::Engine::ApplicationController (NameError)

Steps to reproduce

  1. create app rails v6-beta1
  2. upgrade to rails v6-beta3
  3. run rails s
  4. open localhost:3000

Expected behavior

Open homepage

Actual behavior

Puma caught this error: uninitialized constant ActionText::Engine::ApplicationController (NameError)
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actiontext-6.0.0.beta3/lib/action_text/engine.rb:39:in `block (2 levels) in <class:Engine>'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:429:in `instance_exec'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:606:in `catch'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:606:in `block in default_terminator'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:202:in `block in halting'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:514:in `block in invoke_before'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:514:in `each'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:514:in `invoke_before'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/callbacks.rb:134:in `run_callbacks'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/execution_wrapper.rb:119:in `complete!'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/execution_wrapper.rb:76:in `ensure in block in run!'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/execution_wrapper.rb:76:in `block in run!'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/execution_wrapper.rb:70:in `tap'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.beta3/lib/active_support/execution_wrapper.rb:70:in `run!'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0.beta3/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0.beta3/lib/action_dispatch/middleware/static.rb:126:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0.beta3/lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/sentry-raven-2.9.0/lib/raven/integrations/rack.rb:51:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/webpacker-4.0.0.rc.7/lib/webpacker/dev_server_proxy.rb:29:in `perform_request'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/railties-6.0.0.beta3/lib/rails/engine.rb:523:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
/Users/prokop/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'

System configuration

Rails version: 6.0.0-beta3

Ruby version: 2.6.0

Using puma: 3.12.0

It seems like an error of puma, but because of uninitialized constant ActionText::Engine::ApplicationController (NameError) I guess it could be bug of rails.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 13
  • Comments: 21 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks, @fxn. I gave it a try, but using master did not solve the issue. What did solve it though, was upgrading bootsnap. Only using master did not upgrade it to the lastest version. A new rails app gets bootsnap 1.4.2 while an app upgraded from beta2 to beta3 still has bootsnap 1.4.1. Upgrading bootsnap to 1.4.2 solves the issue.

Ran into the same issue with a minimal Rails test application and fixed it, as suggested above, by adding:

class ApplicationController < ActionController::Base
end

and then inheriting from ApplicationController instead of ActionController::Base. This is a regression in Rails 6.0.0, it wasn’t required to have ApplicationController defined in Rails 5. So I am also wondering if we need this new requirement.

By following Chapter 2 of the book Component-Based Rails Applications, I stumbled upon the same exception. Adding an ApplicationController indeed helps but prevents from having an application built with components / engines an no app folder in the parent application as suggested by Stephan Hagemann in his book.

Why Would You Delete the app Folder? It is optional to delete the app folder at this point. I am suggesting it for a couple of reasons. For one, it sends a clear message to everyone working on the codebase that something special is going on here. Also, the app folder is not currently needed and is likely not going to be needed in the future. Thus, it would be cruft to keep it around right now. And it can always be added back later if needed.

Hagemann, Stephan. Component-Based Rails Applications (Addison-Wesley Professional Ruby Series) (p. 19). Pearson Education. Kindle Edition.

@fxn adding ApplicationController helped. Thanks

Does your application define ApplicationController? Don’t see an autoload for it in the traces.

Zeitwerk does not even get a chance to log something?

Sorry the reproduction steps are a bit ambiguous because you need to “upgrade”.

Can you reproduce generating a minimal brand new beta 3 application?