0

Rails is returning blank HTML when running in production.

The tests I describe bellow are done with the following line: wget http://localhost:3000/login -O here.txt ; cat here.txt. I expect see some HTML being output after executing it.

On my server, I can see the HTML being rendered when I start rails in development mode, using the command rails s. I can see the following in the log:

Started GET "/login" for 127.0.0.1 at 2013-08-21 18:30:32 +0000
Processing by UserSessionsController#new as */*
  Rendered user_sessions/_login.html.haml (59.5ms)
  Rendered user_sessions/new.html.haml within layouts/application (62.8ms)
Compiled bootstrap-datepicker.css  (0ms)  (pid 8050)
Compiled application.css  (4ms)  (pid 8050)
Compiled bootstrap.min.css  (0ms)  (pid 8050)
 # lots of Compiled lines
  Rendered layouts/_navigation.html.haml (3.2ms)
  Rendered layouts/_messages.html.haml (1.0ms)
Completed 200 OK in 1404ms (Views: 1395.6ms | ActiveRecord: 0.8ms)

When starting my application with RAILS_ENV=production rails s, doing the same request, I got the following on the log:

Started GET "/login" for 127.0.0.1 at 2013-08-21 18:30:52 +0000
Processing by UserSessionsController#new as */*
  Rendered user_sessions/_login.html.haml (57.8ms)
  Rendered user_sessions/new.html.haml within layouts/application (60.9ms)
Completed 200 OK in 69ms (ActiveRecord: 0.9ms)

But no HTML is output. What is happening? Why this is not working the same way that it does on development?

I use rails 3.2.13, and in this test it runs with WEBrick. I also am using RVM if that matters.

Update: Using the content of config/environments/development.rb on config/environments/production.rb does not fix the problem

4

1 回答 1

0

问题是我正在抢救 ApplicationController 上的异常并且没有通过逻辑错误正确处理它。开发模式未引发异常。

于 2013-08-21T20:47:13.857 回答