rails: Upgrading Rails to v6-beta3 causes uninitialized constant ActionText::Engine::ApplicationController (NameError)
Steps to reproduce
- create app rails v6-beta1
- upgrade to rails v6-beta3
- run
rails s
- 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
- Bump the dummy app to Rails 6.0.0 Upgrading causes a number of NameErrors: ``` NameError: uninitialized constant ActionText::Engine::ApplicationController ``` The cause of this seems to be missing ... — committed to tijmenb/mail-notify by tijmenb 5 years ago
- Bump the dummy app to Rails 6.0.0 Upgrading causes a number of NameErrors: ``` NameError: uninitialized constant ActionText::Engine::ApplicationController ``` The cause of this seems to be missing ... — committed to tijmenb/mail-notify by tijmenb 5 years ago
- Upgrade bootsnap to 1.4.5 Was causing some errors in Rails 6 when manually testing. More info: https://github.com/rails/rails/issues/35749 — committed to fosterful/scheduler by joelmichael 5 years ago
- Add `ApplicationController` to dummy application Because Action Text expects `ApplicationController` exists. Ref: https://github.com/rails/rails/issues/35749#issuecomment-525083643 — committed to y-yagi/draper by y-yagi 4 years ago
- Add `ApplicationController` to dummy application Because Action Text expects `ApplicationController` exists. Ref: https://github.com/rails/rails/issues/35749#issuecomment-525083643 — committed to y-yagi/draper by y-yagi 4 years ago
- Add support for Rails 6.0 to `ViewContext::BuildStrategy` (#866) * Add support for Rails 6.0 to `ViewContext::BuildStrategy` In Rails 6.0 the API for `ActionView::Base.new` is changing. `ActionVi... — committed to drapergem/draper by y-yagi 4 years ago
Thanks, @fxn. I gave it a try, but using
master
did not solve the issue. What did solve it though, was upgradingbootsnap
. Only usingmaster
did not upgrade it to the lastest version. A new rails app gets bootsnap1.4.2
while an app upgraded frombeta2
tobeta3
still has bootsnap1.4.1
. Upgrading bootsnap to1.4.2
solves the issue.Ran into the same issue with a minimal Rails test application and fixed it, as suggested above, by adding:
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.
Hagemann, Stephan. Component-Based Rails Applications (Addison-Wesley Professional Ruby Series) (p. 19). Pearson Education. Kindle Edition.
@fxn adding
ApplicationController
helped. ThanksDoes 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?