gpt4 book ai didi

html - 调试信息显示为页脚的一部分并且只显示一行? Michael Hartl 的 Ruby on Rails 教程第 7 章

转载 作者:太空宇宙 更新时间:2023-11-04 11:15:17 25 4
gpt4 key购买 nike

Hartl 的 RoR 教程介绍了调试信息,并将其设置为在每个页面底部的单独框容器中显示。而不是显示在一个单独的框中,我的渲染似乎将它与页脚放在一起并且只显示调试信息的第一行。

我的默认浏览器是 Chrome,但我在 Edge 和 Firefox 中也得到了相同的呈现。

Debug information as currently shown

Debug information as it should be displayed per Hartl's text

这是 Hartl 文本的链接,我引用的调试步骤在 list 7.2 中

www.railstutorial.org/book/sign_up

这是来 self 的 css 文件和我的应用程序布局的相关代码。如果您希望我提供任何其他代码,请告诉我,我会更新帖子。感谢您的帮助!

assets/stylesheets/custom.css.scss:

/* Commonly used styling - mixins, variables, etc */

/* Listing 7.2 */
@mixin box_sizing {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

/* Footer */

footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid $grey-medium-light;
color: $grey-light;
a {
color: #555;
&:hover {
color: #222;
}
}
small {
float: left;
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 15px;
}
}
}

/* Miscellaneous */

/* Listing 7.2 */
.debug_dump {
clear: both;
float: left;
width: 100%;
// height: auto;
margin-top: 45px;
@include box_sizing(border-box); // Modified to include argument
}

app/views/layouts/application.html.erb,请参阅底部的 div 类“container”:

<!DOCTYPE html>
<html>
<head>
<!-- Listing 3.32 -->
<!-- Listing 4.3 -->
<title><%= full_title(yield(:title)) %></title>

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>

<!-- Listing 5.8. The point of this is to direct the program to a specific file (in this case, app/views/layouts/_shim.html.erb, evaluate the contents, and insert the results into the view. Previously, the shim code was listed here, which kind of cluttered up the layout file's contents. By branching individual pieces off to their own file, it can help make things cleaner and easier to maintain.-->
<%= render 'layouts/shim' %>

</head>
<body>

<!-- Listing 5.8, the previous header class content stuff that was listed here was moved into its own _header.html.erb file, found in app/views/layouts. Rather than put the code here, it's now referenced with the below render layouts/header command. Coolio! Really makes things a lot easier to manage -->
<%= render 'layouts/header' %>

<div class="container">
<%= yield %>

<!-- Listing 5.12 Adding a reference the footer layout file -->
<%= render 'layouts/footer' %>

<!-- Listing 7.1 Adding debug parameters to the development environment only. Because you don't want users on the production side to see any of this stuff -->
<% debug(params) if Rails.env.development?
</div>

</body>
</html>

最佳答案

您忘记为调试参数添加结束 %> 和 =!

显示调试:

<%= debug(params) if Rails.env.development? %>

关于html - 调试信息显示为页脚的一部分并且只显示一行? Michael Hartl 的 Ruby on Rails 教程第 7 章,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33288554/

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