在网站上崩溃

时间:2010-07-30 11:14:59

标签: ruby-on-rails

我的系统崩溃了。 崩溃的日志是

:ActionView::MissingTemplate (Missing template public/422.html in view path app/views):
  app/controllers/application_controller.rb:148:in `check_user'
  fcgi (0.8.8) lib/fcgi.rb:117:in `session'
  fcgi (0.8.8) lib/fcgi.rb:104:in `each_request'
  fcgi (0.8.8) lib/fcgi.rb:36:in `each'
  dispatch.fcgi:24

Rendering /home5/cipherte/Portfolio/typetrigger/public/500.html (500 Internal Server Error)

2 个答案:

答案 0 :(得分:0)

使用以下内容(来自标准Rails)在项目中创建一个名为public/422.html的文件,然后看看你能走多远

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <title>The change you wanted was rejected (422)</title>
    <style type="text/css">
        body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
        div.dialog {
            width: 25em;
            padding: 0 4em;
            margin: 4em auto 0 auto;
            border: 1px solid #ccc;
            border-right-color: #999;
            border-bottom-color: #999;
        }
        h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
    </style>
</head>

<body>
  <!-- This file lives in public/422.html -->
  <div class="dialog">
    <h1>The change you wanted was rejected.</h1>
    <p>Maybe you tried to change something you didn't have access to.</p>
  </div>
</body>
</html>

答案 1 :(得分:0)

尝试使用

render :file =>"#{RAILS_ROOT}/public/422.html"

而不是

render :template =>"public/422.html"