Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby LoadError(无法自动加载常量错误::ErrorHandler_Ruby_Ruby On Rails 5 - Fatal编程技术网

Ruby LoadError(无法自动加载常量错误::ErrorHandler

Ruby LoadError(无法自动加载常量错误::ErrorHandler,ruby,ruby-on-rails-5,Ruby,Ruby On Rails 5,我正在尝试为整个应用程序构建错误模块 config.eager_load_paths << Rails.root.join('lib') 我已将此模块包含在ApplicationController中 include Error::ErrorHandler 但每当我尝试点击任何错误时,控制台就会抛出 LoadError (Unable to autoload constant Error::ErrorHandler, expected /Users/username/path/l

我正在尝试为整个应用程序构建错误模块

config.eager_load_paths << Rails.root.join('lib')
我已将此模块包含在ApplicationController中

include Error::ErrorHandler
但每当我尝试点击任何错误时,控制台就会抛出

LoadError (Unable to autoload constant Error::ErrorHandler, expected /Users/username/path/lib/error/error_handler.rb to define it):

Error during failsafe response: Unable to autoload constant Error::ErrorHandler

有人能帮我吗?谢谢,你也需要把它添加到
config.autoload\u路径中。@fyloi我也尝试过添加config.autoload\u路径。但是结果是一样的。另外,
error\u handler.rb
需要在
/lib/error/
@fyloi我提到error\u handler.rb在lib/error/directory添加中
config.autoload_path+=Dir[“#{Rails.root}/lib”]
和服务器重启总是对我有用。我不知道你为什么会遇到错误。你是在应用程序.rb发生更改后重新启动服务器的吗?你也需要将它添加到
config.autoload\u路径中。@fyloi我也尝试过添加config.autoload\u路径。但是结果是一样的。另外,
error\u handler.rb
需要在
/lib/error中/
@fylooi我已经提到error_handler.rb在lib/error/directoryadding
config.autoload_paths+=Dir[“{Rails.root}/lib]”中,服务器重启对我来说总是有效的。我不知道你为什么会遇到错误。你在application.rb发生更改后重启了服务器吗??
LoadError (Unable to autoload constant Error::ErrorHandler, expected /Users/username/path/lib/error/error_handler.rb to define it):

Error during failsafe response: Unable to autoload constant Error::ErrorHandler