[英]How can I test error pages in rails development environment?
I want to design my 404 page in my Rails 3.0.7 app. 我想在我的Rails 3.0.7应用程序中设计我的404页面。 If I request a non existing page I get the development output
如果我请求一个不存在的页面,我得到了开发输出
Routing Error
No route matches "/foo"
I tried the following answers in: 我尝试了以下答案:
How to test 500.html in rails development env? 如何在rails开发环境中测试500.html?
application_controller: application_controller:
def local_request?
false
end
development.rb: development.rb:
config.consider_all_requests_local = false
development.rb: development.rb:
config.action_view.debug_rjs = false
and I also started my app with: RAILS_ENV=production rails s RAILS_ENV=production passenger start 我也开始了我的应用程序:RAILS_ENV =生产轨道s RAILS_ENV =生产乘客开始
None of it worked.I love how rails makes complicated tasks very simple. 它都不起作用。我喜欢rails如何使复杂的任务变得非常简单。 But it's really frustrating how really simple things turn out tu be overwhelmingly difficult, impossible to debug and you end up hacking on remote servers to work around it..
但是真正令人沮丧的是,真正简单的事情变得非常困难,无法调试,最终你会破解远程服务器来解决它。
Has anyone had this problem before? 以前有人有这个问题吗?
如果您的错误页面是静态的,您只需转到http:// localhost:3000 / 404.html , http:// localhost:3000 / 500.html等。
Best idea I've come up with so far is to run the server in production mode locally. 我到目前为止最好的想法是在本地以生产模式运行服务器。
rails s -e production rails s -e production
cheers. 干杯。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.