简体   繁体   English

如何调试Rails应用程序?

[英]How to debug Rails application?

I'm new to Ruby on Rails and I'm facing quite a number of logical errors which I'm unaware of. 我是Ruby on Rails的新手,并且遇到了很多我不知道的逻辑错误。 Like a normal programmer, the thing to solve your errors is by debugging it first. 像普通程序员一样,解决您的错误的方法是首先对其进行调试。 May I know how to debug it? 我可以知道如何调试吗? Because when i tried doing so, it already shows me an error: 因为当我尝试这样做时,它已经显示了一个错误:

"Uncaught exception: uninitialized constant Object::ApplicationController" “未捕获的异常:未初始化的常量Object :: ApplicationController”

May I know how to solve this error and how to debug? 我可以知道如何解决此错误以及如何调试吗? Thanks! 谢谢! :) :)

You can either do it the quick and dirty way, in your code: 您可以在代码中快速而又肮脏地执行此操作:

raise my_object.inspect

This will throw an exception with the information about the object. 这将引发有关对象信息的异常。

Or use the ruby-debug gem. 或使用红宝石调试宝石。

I recommend you read the Debugging Rails Applications chapter in the Rails documentation. 我建议您阅读Rails文档中的“ 调试Rails应用程序”一章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM