English 中文(简体)
铁路3:我不认为
原标题:Rails 3: My view is not being rendered

I m new to rails. 我有我的控制者和看法。

When I view my html source, my body is empty. I put a debugger in my controller and my view and it hits both so I know it s being executed. Any idea what I m doing wrong? I have also installed bootstrap.

Thank you in advance. see below.

class ListController < ApplicationController
  def recent
    @page_title = @head_title="Lists"
  end
end

近期.html

    <ul class="tabs">
  <li class="active"><a href="#">Lorem</a></li>
  <li><a href="#">Ipsum</a></li>
  <li><a href="#">Dolor</a></li>
  <li><a href="#">Sit</a></li>
  <li><a href="#">Amet</a></li>
</ul>

申请:html.erb

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= content_for?(:title) ? yield(:title) : "Myapp" %></title>
    <meta name="description" content="">
    <meta name="author" content="">
    <%= stylesheet_link_tag    "application", :media => "all" %>
    <%= javascript_include_tag "application" %>
    <%= csrf_meta_tags %>
    <%= yield(:head) %>
  </head>

</html>

html 源代码

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Myapp</title>
    <meta name="description" content="">
    <meta name="author" content="">
    <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/custom.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/home.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/twitter/bootstrap.css?body=1" media="all" rel="stylesheet" type="text/css" />
    <script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/alert.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/button.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/carousel.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/collapse.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/dropdown.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/modal.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/tooltip.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/popover.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/scrollspy.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/tab.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/transition.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap/typeahead.js?body=1" type="text/javascript"></script>
<script src="/assets/twitter/bootstrap.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-transition.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-alert.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-button.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-carousel.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-collapse.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-dropdown.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-modal.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-scrollspy.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-tab.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-tooltip.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-popover.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-typeahead.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
    <meta content="authenticity_token" name="csrf-param" />
<meta content="7imEFVfD5bYIV7ZcK4181eCoz0pKxyyE2G+UFI46v5U=" name="csrf-token" />

  </head>

</html>

从服务器记录中提取

Started GET "/list/recent" for 127.0.0.1 at Fri May 18 17:54:57 -0700 2012 Processing by ListController#recent as HTML Rendered list/近期.html within layouts/application (0.8ms) Completed 200 OK in 17ms (Views: 16.9ms | ActiveRecord: 0.0ms)

最佳回答

简而言之,您没有<who> tag 或您申请中的任何观点内容?

仅添加以下文字:</html>:

<body>
  <%= yield %>
</body>

没有任何论点的yield将 gr掉从已表达的观点中的内容,并将之推到你的申请中。

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签