我不确定如何使用twitter bootstrap选项卡显示模型的索引视图。我有以下代码,但它给我一个丢失的模板错误。感谢。
application.html.erb
<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#profile" data-toggle="tab">Profile</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home">
<p>Home...</p>
</div>
<div class="tab-pane fade" id="profile">
<%= render :template => 'goals#index' %>
</div>
</div>
更新1:显示佣金路线的输出
goals GET /goals(.:format) goals#index
POST /goals(.:format) goals#create
new_goal GET /goals/new(.:format) goals#new
edit_goal GET /goals/:id/edit(.:format) goals#edit
goal GET /goals/:id(.:format) goals#show
PUT /goals/:id(.:format) goals#update
DELETE /goals/:id(.:format) goals#destroy
更新2:错误输出
缺少模板/目标#index与{:locale =&gt; [:en],:formats =&gt; [:html],:handlers =&gt; [:erb,:builder,:coffee]}。搜索:
干杯, Azren
答案 0 :(得分:0)
从我可以看到你想要呈现一个控制器的索引动作,所以我建议在相应的视图目录中创建一个index.html.erb,这是因为它呈现错误模板的错误的原因是因为它在视图&gt; controller_name&gt; action.html.erb
中搜索模板如果您使用的是不是CRUD(创建,读取,更新销毁)的操作,请确保将其添加到您的routes.rb
resource :controller do
collection do
get 'action'
post 'action', path: "value"
end
end