2015-11-06 44 views
0

日誌顯示應用程序正在尋找「上崗」,但我使用了索引頁面上部分是「後」:服務器錯誤::的ActionView MissingTemplate

<div id="posts"> 
    <h2>Here are the latest posts</h2> 
    <%= render 'post' %> 
</div> 

這裏的日誌條目:

ActionView::MissingTemplate - Missing partial posts/_posts 

有一段時間我使用posts/_posts,但是我把它改爲posts/_post。除了索引頁面上的部分位置之外,可以在哪裏進行此調用?部分在相同的PostsController中。

回答

0

假設你的部分是在posts/_post下,你想使用<%= render partial: 'post' %>

+0

試過,無濟於事。我將所有內容都改回「帖子/帖子」,錯誤消失了。即使在我將所有內容更改爲「posts/post」 –

+0

之後,我仍然想知道該電話來自哪裏?您是否命名了文件「_post.html.erb」? – mmichael

+0

是的,它在views/posts文件夾中被命名爲_post.html.erb(但是我已經重命名爲_posts.html.erb –

相關問題