imjp
imjp

Reputation: 6695

Partial isn't working

I'm new to rails and I'm following the first tutorial on api.rubyonrails.org.

However, I've finished the entire tutorial except for a specific problem I've skipped. The following partial isn't working:

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

For some reason, it throws the following error:

Missing partial comments/comment with

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

I don't quite understand what the purpose of :collection is(perhaps someone could elaborate).

You can find see the files on my github repo below: http://github.com/imjp/blog

Upvotes: 1

Views: 966

Answers (1)

apneadiving
apneadiving

Reputation: 115541

You simply misspelled the name of the partial:

_comment.html.errb 

instead of:

_comment.html.erb 

For the explanation of collection see here: http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials

Para 3.4.5

Upvotes: 5

Related Questions