gpt4 book ai didi

ruby - 如何更改 Rails 错误消息文本 "We' 抱歉,出了点问题。”

转载 作者:数据小太阳 更新时间:2023-10-29 08:36:45 26 4
gpt4 key购买 nike

谁能告诉我如何更改 Ruby on Rails 错误消息“很抱歉,出了点问题。”我只是想更改此错误的文本,但出于某种原因,无法弄清楚此页面/文本所在的位置以便我可以修改它。

提前感谢您的宝贵时间。

耐多药

最佳答案

代码位于public/500.html。您可以根据需要更改它。

#public/500.html
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}

div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}

div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}

h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}

div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>

<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

您可以使用自己的动态错误页面自定义错误消息。看看这个tutorial关于如何实现它。

关于ruby - 如何更改 Rails 错误消息文本 "We' 抱歉,出了点问题。”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33636074/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com