# Problem in following Ruby 'Blog' Screencast

**URL:** <https://www.ruby-forum.com/t/problem-in-following-ruby-blog-screencast/157338>\
**Category:** Rails\
**Created:** [January 9, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/problem-in-following-ruby-blog-screencast/157338 "2009-01-09T16:55:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@michael](https://www.ruby-forum.com/u/michael)\
**Post date:** [January 9, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/problem-in-following-ruby-blog-screencast/157338/1 "2009-01-09T16:55:09Z")

</div>

Hi all,

When attempting to follow the screencast, ‘Creating a weblog in 15  
minutes with Rails 2’, I’ve hit a problem when creating the  
‘partial’. As soon as the index.html.erb,

# Listing posts

\<%= render :partial =\> @posts %\>

\<%= link\_to ‘New post’, new\_post\_path %\>

with \_post.html.erb.

\<% div for post do %\>

## \<%= link\_to\_unless\_current h(post.title), post %\>
 \<%= simple\_format h(post.body) %\> \<% end %\>

and show.html.erb,

\<%= render :partial =\> @post %\>

\<%= link\_to 'Edit', edit\_post\_path(@post) %\> | \<%= link\_to 'Destroy', @post, :method =\> :delete, :confirm =\> "Are you sure?" %\> \<%= link\_to 'See All Posts', posts\_path %\>

I’m getting the following error:

SyntaxError in Posts#index

Showing app/views/posts/\_post.html.erb where line #1 raised:

compile error  
/Users/michael/Desktop/rails\_demo/blog/app/views/posts/\_post.html.erb:  
1: syntax error, unexpected kDO\_BLOCK, expecting tCOLON2 or ‘[’ or ‘.’  
old\_output\_buffer = output\_buffer;post = local\_assigns  
[:post];object = local\_assigns[:object];post\_counter = local\_assigns  
[:post\_counter];;@output\_buffer = ‘’; \_\_in\_erb\_template=true ; div  
for post do ; @output\_buffer.concat “\n”

^  
/Users/michael/Desktop/rails\_demo/blog/app/views/posts/\_post.html.erb:  
5: syntax error, unexpected kENSURE, expecting $end

Extracted source (around line #1):

1: \<% div for post do %\>  
2:

## \<%= link\_to\_unless\_current h(post.title), post %\>
  
3: \<%= simple\_format h(post.body) %\>  
4: \<% end %\>

Trace of template inclusion: app/views/posts/\_post.html.erb, app/views/  
posts/index.html.erb

Any ideas?

ruby --version  
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]

Cheers  
Mike

---

<div class="post-metadata">

**Author:** ![michael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@michael](https://www.ruby-forum.com/u/michael)\
**Post date:** [January 9, 2009, 5:20pm UTC](https://www.ruby-forum.com/t/problem-in-following-ruby-blog-screencast/157338/2 "2009-01-09T17:20:29Z")

</div>

Take the “div” out of there … that looks odd there.

Just looking over it, that looks like the problem (maybe). However, I  
haven’t watched the new screencast … so I can’t really tell you.

---

<div class="post-metadata">

**Author:** ![michael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@michael](https://www.ruby-forum.com/u/michael)\
**Post date:** [January 9, 2009, 5:22pm UTC](https://www.ruby-forum.com/t/problem-in-following-ruby-blog-screencast/157338/3 "2009-01-09T17:22:50Z")

</div>

Bobnation wrote:

> Take the “div” out of there … that looks odd there.

Certainly does.

> Just looking over it, that looks like the problem (maybe). However, I  
> haven’t watched the new screencast … so I can’t really tell you.

Also shouldn’t it be

for post in @posts do  
…  
end

Unless there’s some ruby cleverness I’ve missed.

HTH

Matt
