开发者

Rails 2.3.8 not displaying stack trace in browser, instead shows 500.html

stack trace is not showing like it should (in the browser). Instead I get public/500.html rendered. The problem seems to be recreated when I created a new rails project and apply the haml plugin. Originally I though it was this ruby script causing the problem:

class ToHaml
  def initialize(path)
    @path = path
  end

  def convert!
    Dir["#{@path}/**/*.erb"].each do |file|
    `html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
    `rm #{file}`
    end
  end
end

path = File.join(File.dirname(__FILE__), 'app', 'views')
ToHaml.new(path).convert!

I though it might have deleted an erb template used to show the stack trace. That do开发者_Python百科esn't appear to be the case because I can't find any template for that in app/views.

So it must be the haml plugin which is causing the problem

haml --rails MyRubyApp

Not sure how, but after I run this stack traces no longer display in the browser (just the 500.html). I've tried explicitly launching the server in development mode without any effect.

Anybody have insight on this? Thanks in advance.


This seems to me like you're running the new Rails application in the production environment rather than development. Check your RAILS_ENV variable and the environment.rb file to make sure that you are running in development, and not production.


You may look for your error stack traces in log/development.log (or log/production.log if you're running in production, or whatever place you write your logs to).


The solution was to download an http sniffer and have a look at the post data. turns out there was a syntactic problem (although valid) in some of my view code (a pair of "[]" appended to a string which shouldn't have been there).

Hope this helps anyone experiencing the same kind of issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜