Rails控制台错误输出

时间:2016-10-07 04:17:28

标签: ruby-on-rails ruby rails-console

我刚刚更新了Ruby(2.3.1)和Rails(5.0.0.1)。现在,当我在rails控制台上收到错误(任何类型的错误)时,接下来是来自/ Users ...... /。rvm /的'开头的大约15-20行。 .etc&#39 ;.知道为什么我得到这么多行的错误输出,如果它是正常的?我该怎么办呢?关于Ruby / Rails的其他所有内容对我来说都非常好,所以也许它只是正常的输出。但是,这有点令人烦恼。

每条路径的共性似乎都是' .rvm'。 例如:

  2.3.1 :031 > test
ArgumentError: wrong number of arguments (given 0, expected 2..3)
    from (irb):31:in `test'
    from (irb):31
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AlfonsoGiron/workspace/sample_app/bin/rails:9:in `<top (required)>'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1@global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
    from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /Users/AlfonsoGiron/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/AlfonsoGiron/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'
2.3.1 :032 > 

感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

Rails控制台使用IRB,因此您必须编辑IRB配置文件,通常位于~/irbrc,并更改BACK_TRACE_LIMIT值:

IRB.conf[:BACK_TRACE_LIMIT]=0

在Rails控制台会话期间,您还可以运行:

conf.back_trace_limit = 0

IRB还有更多配置选项(扩展名为Rails控制台)。请在ruby-doc.org处查看。