Rails缺少模板

时间:2015-11-27 06:03:05

标签: ruby-on-rails twitter-bootstrap devise

我的视图/布局文件夹中有模板,但仍然显示缺少模板。还有twitter bootstrap不工作

Missing partial layouts/_user_header with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
  * "/home/techbirds/shivam/app/views"
  * "/home/techbirds/.rvm/gems/ruby-2.2.1/gems/devise-3.5.2/app/views"


(application.html.erb)

<!DOCTYPE html>
<html>
<head>
  <title>Shivam</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>
<% flash.each do |key, value| %>
    <div class="alert alert-<%= key %> alert-dismissable">

        <%= value %>
    </div>
<% end %>
<div class="container-narrow">
  <div class="masthead">
    <%= render 'layouts/user_header' %>
    <h3 class="muted"><%= link_to "SimpleDevise", root_path %></h3>
    <h5 class="muted">A demo of using SimpleDB with Devise</h5>
  </div>
  <hr />
  <%= yield %>
</div>

<% if user_signed_in? %>

  <%= link_to('Logout', destroy_user_session_path, :method => :delete) %>        

<% else %>

  <%= link_to('Login', new_user_session_path)  %>  

<% end %>
<%= yield %>

</body>
</html>


我在我的(application.js)中添加了这行// = require twitter / bootstrap
我在我的(application.css)

中添加了这行* = require twitter / bootstrap

3 个答案:

答案 0 :(得分:1)

请保持views/layouts文件夹清洁。你可以把你的部分放在views/application文件夹中。

如果你这样做,你可以这样做:

 `<%= render 'user_header' %>`

答案 1 :(得分:0)

<强>更新

application.html.erb

<%= render partial: 'layouts/user_header' %>

partial

中添加views

视图/布局/ _user_header.html.erb

# erb content goes here

答案 2 :(得分:0)

你应该再次检查部分而不是bootstrap。因为错误消息适用于部分非引导程序。