Rails 6:未初始化的常量 ActionText::Engine::ApplicationController (N


Puma caught this error: uninitialized constant ActionText::Engine::ApplicationController (NameError)
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actiontext-6.0.1/lib/action_text/engine.rb:43:in `block (2 levels) in <class:Engine>'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:429:in `instance_exec'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:429:in `block in make_lambda'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:606:in `catch'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:606:in `block in default_terminator'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:202:in `block in halting'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `block in invoke_before'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `each'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `invoke_before'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:134:in `run_callbacks'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:119:in `complete!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:76:in `ensure in block in run!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:76:in `block in run!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:70:in `tap'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:70:in `run!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/static.rb:126:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/webpacker-4.2.0/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/engine.rb:526:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/configuration.rb:228:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/server.rb:667:in `handle_request'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/server.rb:470:in `process_client'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/server.rb:328:in `block in run'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/thread_pool.rb:134:in `block in spawn_thread'

很可能您的应用程序缺少ApplicationController类。 您能否仔细检查该案例是否存在于app/controllers/application_controller.rb

如果您没有立即找到该文件,请不要担心!您的应用的结构可能不依赖于定义ApplicationController。ActionText 有一个长期存在的问题,因此您可能难以使用它。

您可以跟踪这个未解决的问题,该问题讨论了在不依赖于默认ApplicationController类的项目中使用ActionTexthttps://github.com/rails/rails/issues/37183

如果不是这种情况,那么您可以通过在上述目录中创建类来简单地解决此问题。

享受!

相关内容

  • 没有找到相关文章

最新更新