# Render partial, object.property missing

**URL:** <https://www.ruby-forum.com/t/render-partial-object-property-missing/101267>\
**Category:** Rails\
**Created:** [February 5, 2006, 4:29pm UTC](https://www.ruby-forum.com/t/render-partial-object-property-missing/101267 "2006-02-05T16:29:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew\_collins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e79b87/32.png) [@matthew\_collins](https://www.ruby-forum.com/u/matthew_collins)\
**Post date:** [February 5, 2006, 4:29pm UTC](https://www.ruby-forum.com/t/render-partial-object-property-missing/101267/1 "2006-02-05T16:29:13Z")

</div>

trying to do my first rails app (surprise, it’s a blog!)

anyhow.

in list.rhtml, i have this:

\<% for post in @posts

```
render(:partial => "post", :object=>post)

```

end %\>

and in \_post.rhtml, i have:

 \<%= post.title%\>   
 \<%= post.body%\>  

problem is, no content shows up – displays a blank page. for the  
record, if i put that same partial within the list.rhtml, i get the  
content displayed correctly.

thanks in advance for the help

---

<div class="post-metadata">

**Author:** ![matthew\_collins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e79b87/32.png) [@matthew\_collins](https://www.ruby-forum.com/u/matthew_collins)\
**Post date:** [February 5, 2006, 5:08pm UTC](https://www.ruby-forum.com/t/render-partial-object-property-missing/101267/2 "2006-02-05T17:08:38Z")

</div>

On 2/5/06, matthew collins [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> problem is, no content shows up – displays a blank page. for the  
> record, if i put that same partial within the list.rhtml, i get the  
> content displayed correctly.

Try replacing these three lines:  
\<% for post in @posts %\>  
\<%= render(:partial =\> “post”, :object=\>post) %\>  
\<% end %\>

…with:  
\<%= render :partial =\> ‘post’, :collection =\> @posts %\>

The other way would be to do:  
\<% for post in @posts %\>  
\<%= render :partial =\> ‘post’, :locals =\> {:post =\> post} %\>  
\<% end %\>

…but that’s three times as much code. 🙂

---

<div class="post-metadata">

**Author:** ![matthew\_collins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e79b87/32.png) [@matthew\_collins](https://www.ruby-forum.com/u/matthew_collins)\
**Post date:** [February 5, 2006, 5:14pm UTC](https://www.ruby-forum.com/t/render-partial-object-property-missing/101267/3 "2006-02-05T17:14:40Z")

</div>

not to burn bandwidth with a simple ‘thanks’; but, wow — that’s  
simple.

thanks!
