Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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 on rails 4 如何在RubyonRails中禁用详细控制台?_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails 4 如何在RubyonRails中禁用详细控制台?

Ruby on rails 4 如何在RubyonRails中禁用详细控制台?,ruby-on-rails-4,Ruby On Rails 4,例如,当我使用console进行RoR时,出现了一个错误,我得到了使用的GEM/LIB列表 SyntaxError: /Users/user/Sites/Jobsite/app/models/subject.rb:11: syntax error, unexpected ']', expecting ')' where(["name LIKE ?"], "%#{query}%"]) ^ from /U

例如,当我使用console进行RoR时,出现了一个错误,我得到了使用的GEM/LIB列表

SyntaxError: /Users/user/Sites/Jobsite/app/models/subject.rb:11: syntax error, unexpected ']', expecting ')'
    where(["name LIKE ?"], "%#{query}%"])
                                        ^
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:443:in `load'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:443:in `block in load_file'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:633:in `new_constants_in'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:442:in `load_file'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:342:in `require_or_load'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:480:in `load_missing_constant'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:180:in `const_missing'
    from (irb):1
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/console.rb:90:in `start'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/console.rb:9:in `start'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:69:in `console'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
    from /Users/user/Sites/Jobsite/bin/rails:8:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
    from /Users/user/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/user/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
SyntaxError:/Users/user/Sites/Jobsite/app/models/subject.rb:11:语法错误,意外']',预期'''
其中([“名称类似?”],“%#{query}%]”)
^
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:443:in'load'
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:443:“加载文件中的块”
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:633:in`new\u constants\u in'
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:442:“加载文件”中
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:342:in“require\u或\u load”
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:480:在'load\u missing\u constant'中
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:180:in'const\u missing'
来自(irb):1
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/console.rb:90:在“开始”中
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/console.rb:9:in'start'
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:69:在“控制台”中
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands/commands\u tasks.rb:40:in“run\u command!”
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.1.0/lib/rails/commands.rb:17:in`'
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:247:in'require'
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:247:“请求中的块”中
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u-support/dependencies.rb:232:in'load\u dependencity'
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:247:in'require'
from/Users/user/Sites/Jobsite/bin/rails:8:in`'
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:241:in'load'
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:241:“加载中的块”中
from/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u-support/dependencies.rb:232:in'load\u dependencity'
来自/Users/user/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.1.0/lib/active\u support/dependencies.rb:241:in'load'
来自/Users/user/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/site\u ruby/2.0.0/rubygems/core\u ext/kernel\u require.rb:55:in'require'
来自/Users/user/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/site\u ruby/2.0.0/rubygems/core\u ext/kernel\u require.rb:55:in'require'

我真的需要这个还是我可以禁用它,因为每次我得到这个,我需要向上滚动,我不那么容易看到错误消息本身

你可以试着换一下

您还可以通过将其放入初始值设定项来关闭SQL日志记录:

ActiveRecord::Base.logger = nil
可能类似于-
config/initializers/activerecord\u logger.rb


此处有更多信息-

您可以在
config/environments/development.rb
中将设置
考虑所有请求\u local
true
更改为
false
,这样它就不会显示堆栈跟踪:

Jobsite::Application.configure do
  config.consider_all_requests_local = false
end