部分不起作用

时间:2011-06-18 09:19:41

标签: ruby-on-rails

我是rails的新手,我正在关注api.rubyonrails.org上的第一个教程。

但是,除了我跳过的特定问题之外,我已经完成了整个教程。 以下部分不起作用:

<%= render :partial => 'comments/comment',
           :collection => @post.comments %>

出于某种原因,它会引发以下错误:

缺少部分评论/评论
{:handlers=>[:erb, :builder], :formats=>[:html], :locale=>[:en, :en]}. Searched in:
  * "c:/rails/blog/app/views"

我不太明白收集的目的是什么(也许有人可以详细说明)。

您可以在下面找到我的github repo上的文件: http://github.com/imjp/blog

1 个答案:

答案 0 :(得分:5)

你只是错误拼写了部分名称:

_comment.html.errb 

而不是:

_comment.html.erb 

有关collection的说明,请参阅此处:http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials

Para 3.4.5