简体   繁体   English

如何在rails开发环境中测试错误页面?

[英]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.htmlhttp:// 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.

相关问题 如何确定我的 rails 是否在开发环境中而不是在测试环境中? - How can I determine if my rails is in the development environment and not the test environment? 如何从我的开发和测试环境中获取空气制动器? - How can I get airbrake out of my development and test environment? 如何在Rails的测试环境中添加Rack Middleware? - How can I add Rack Middleware to the test environment in Rails? 如何仅在Rails的测试环境中插入日志? - How can I insert logs just in test environment in Rails? 如何测试生产环境而不是测试环境Rails - How can I test my production environment instead of my test environment Rails 我可以在测试/开发环境中运行heroku应用程序吗 - Can I run my heroku app in Test/Development environment 我可以将Rails控制器方法限制在开发环境中吗? - Can I restrict Rails controller methods to development environment? 如何在测试环境中为Time类定义“解析”,而不是开发或生产? - How can 'parse' be undefined for Time class in test environment, but not development or production? 在Rails开发环境中如何获取Hoptoad或Airbrake错误通知 - How to get Hoptoad or Airbrake Error Notification in Development Environment on Rails 如何禁止在Rails上的开发环境中运行代码? - How do I disable code from running in the development environment on Rails?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM