Rails在开发模式下不会记录模板错误 [英] Rails doesn't log template errors in development mode
问题描述
我的Rails 3.2.9-app不会向我显示有关模板中的错误的任何特定错误信息!不管我使用haml还是erb,我总是得到
My Rails 3.2.9-app does not show any specific error information to me on errors in templates! It doesn't matter if I use haml or erb, I am always getting
对不起,出了点问题
"We're sorry, but something went wrong"
事实上,Webrick 处于开发模式,如果我的模型或控制器有错误,我会得到
In fact, Webrick is in development mode and if there are errors in my models or controllers, I get the full ordinary error screen.
我的助手模板中的示例错误( @resource不存在,必须为资源):
->我得到的只是这个糟糕的对不起,但是出了点问题
<%@ resource.errors.full_messages.each do | msg | %>
Example error in my helper-template ("@resource" does not exist, must be "resource"):
-> All I get is this lousy "We are sorry, but something went wrong"
<% @resource.errors.full_messages.each do |msg| %>
我的一个控制器出现示例错误:
resposnd_to做| format |
-> ...
Example error in one of my controllers:
resposnd_to do |format|
-> undefined method `resposnd_to' for ...
推荐答案
我终于解决了这个问题!总而言之,我搜索了一年多,但是现在,我终于找到了解决方案:
I finally solved this problem!! All in all, I searched for more than 1 year, but now, i finally got the solution:
问题是在路径的末尾使用变音符号或空格Rails项目。如果您将rails项目移动到没有变音符号或空白的路径,则错误消息应正确显示:-)!
The problem is to use umlauts or blank spaces in the path of the rails project. If you move your rails project to a path without umlauts or blanks, the error message should be shown properly :-)!
在ubuntu上进行了测试-machine,也许这对于此错误很重要。此错误绝对会出现在rails 3.2.9、3.2.13和3.2.14中。
Tested on ubuntu-machine, maybe this is important for this bug. This bug appears in rails 3.2.9, 3.2.13 and 3.2.14 definitely.
(当然,consider_all_requests_local已激活,这从来都不是原因)
(consider_all_requests_local is activated of course, this never was the reason)
这篇关于Rails在开发模式下不会记录模板错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!