Rails 3.2.13, 500 error in development with no log

梦想与她 提交于 2019-12-24 14:06:17

问题


I've got problem with migrating rails 2.x -> 3.2.13 At some point, after fixing a few things, I get Completed 500 Internal Server Error in 76ms without any traceback.

development.rb

config.consider_all_requests_local       = true
config.action_controller.perform_caching = false

Why there is no traceback and how to fix this?


回答1:


you probably solved it but I wanted to share my couple of hours debugging about this issue as it can be very annoying. In short, I was having the same problem - 500 internal server error without any log of the exception thrown. It was happening only for exceptions thrown in the action view templates - any ActionView::Template::Error exception. For example, missing partial, invalid route.

My specific problem was using this ruby statistics module:

http://derrick.pallas.us/ruby-stats/

directly in the initializers directory which works great in rails 2.x. It defined Array.sum method which is already defined in rails 3 under Enumerable.sum. The problem with the redefine is that Array.sum no longer works with arrays of strings which is what rails was trying to do with ActionView::Template::Error.source_extract method - when trying to extract the source of the error in template, it uses the Enumerable.sum method which is redefined in a wrong way. Thus, another exception happened TypeError: cannot convert String into Fixnum and the original exception was not logged, neither was the new one. I had to do a backtrace and go through many of the internal calls to see where is the issue.

So, for everyone not seeing the actual exceptions thrown in your ActionView templates, check if you have not redefined a rails method that is used internally in rails.



来源:https://stackoverflow.com/questions/16891402/rails-3-2-13-500-error-in-development-with-no-log

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