set rails console stack backtrace limit permanently

痞子三分冷 提交于 2019-11-29 11:17:11
Fer

You have to create/edit your ~/.irbrc with the following:

IRB.conf[:BACK_TRACE_LIMIT]= 20

To be taken into account:

  • The options must be uppercased
  • This option is changing not only the rails console, but the normal "irb" behavior (the rails console uses irb to run)
  • This setting is global, and not per project

Reference http://rakeroutes.com/blog/customize-your-irb/

Update for Rails 5

In Rails 5 the command context.back_trace_limit=20 will fail.

In the console you need to use the command conf.back_trace_limit = 10 for the current session.

For permanent changes, writing IRB.conf[:BACK_TRACE_LIMIT]= 20 in your ~/.irbrc is still valid.

You can see the current settings by calling conf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!