缺少模板 - 铁轨

时间:2012-07-10 17:04:02

标签: ruby-on-rails ruby templates

以下是我项目中视图的结构

app
  |
   - views
         | admin
               |
               sidebar.html.erb
         |
         layouts
               |
               admin.html.erb

admin.html.erb的内容

<html>
<head>
  <title>Blog</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>
    <div id="container"> <!-- Container begins here -->

<%= render "admin/sidebar" %>

<%= yield %>

    </div> <!-- END Content -->
</div> <!-- END Primary -->


<div class="clear"></div>
</div> <!-- END Container -->

</body>
</html>

我收到此错误

Missing partial admin/sidebar with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in:
  * "/Users/me/blog/app/views"
  * "/Users/me/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/app/views"

我尝试了不同的侧边栏路径,但没有成功。

1 个答案:

答案 0 :(得分:1)

它应该是“_sidebar.html.erb”。部分文件名需要以'_'开头。