# Strange partial

**URL:** <https://www.ruby-forum.com/t/strange-partial/188692>\
**Category:** Rails\
**Created:** [May 16, 2010, 7:09pm UTC](https://www.ruby-forum.com/t/strange-partial/188692 "2010-05-16T19:09:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [May 16, 2010, 7:09pm UTC](https://www.ruby-forum.com/t/strange-partial/188692/1 "2010-05-16T19:09:02Z")

</div>

I am struggling with a strange effect when using two partials  
This is show.html.erb

## posts commented on by \<%= @user.login %\>
 \<%= render :partial =\> @posts\_commented\_on %\> 
## Posts submitted by \<%= @user.login %\>
 \<%= render :partial =\> @posts\_submitted %\> 

This is the relevant bit of users.html.erb

 \<%= yield %\> 

This is from users\_controller.rb  
def show  
@user = User.find(params[:id])  
@posts\_submitted = @user.posts.find(:all,  
:limit =\> 6, :order =\> ‘posts.id DESC’)  
@posts\_commented\_on = @user.posts\_commented\_on.find(:all,  
:limit =\> 2, :order =\> ‘comments.id DESC’)  
end

Can anybody tell me where the div, that splits submitted from comments,  
appears from?

---

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [May 17, 2010, 12:00pm UTC](https://www.ruby-forum.com/t/strange-partial/188692/2 "2010-05-17T12:00:23Z")

</div>

On May 16, 6:09 pm, Neil B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can anybody tell me where the div, that splits submitted from comments,  
> appears from?

What does the post partial & generated html look like ? Could you have  
forgotten to close a tag or something like that ?

Fred

---

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [May 17, 2010, 1:47pm UTC](https://www.ruby-forum.com/t/strange-partial/188692/3 "2010-05-17T13:47:13Z")

</div>

Frederick C. wrote:

> On May 16, 6:09ï¿½pm, Neil B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Can anybody tell me where the div, that splits submitted from comments,  
> > appears from?
> 
> What does the post partial & generated html look like ? Could you have  
> forgotten to close a tag or something like that ?
> 
> Fred  
> Hope this helps

I’ve attached the generated html.  
The partials are defined in this extract from user\_controller.rb  
def show  
@user = User.find(params[:id])  
@posts\_submitted = @user.posts.find(:all,  
:limit =\> 6, :order =\> ‘posts.id DESC’)  
@posts\_commented\_on = @user.posts\_commented\_on.find(:all,  
:limit =\> 2, :order =\> ‘comments.id DESC’)  
end  
How can it create a div in the middle of a find operation?

---

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [May 17, 2010, 6:31pm UTC](https://www.ruby-forum.com/t/strange-partial/188692/4 "2010-05-17T18:31:53Z")

</div>

You were right, stupid of me. Thanks

---

<div class="post-metadata">

**Author:** ![neilbain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b487fb/32.png) [@neilbain](https://www.ruby-forum.com/u/neilbain)\
**Post date:** [May 17, 2010, 2:29pm UTC](https://www.ruby-forum.com/t/strange-partial/188692/5 "2010-05-17T14:29:04Z")

</div>

On Mon, May 17, 2010 at 7:47 AM, Neil B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hope this helps  
> How can it create a div in the middle of a find operation?
> 
> Attachments:  
> [http://www.ruby-forum.com/attachment/4739/index.html.erb](http://www.ruby-forum.com/attachment/4739/index.html.erb)

Let’s look at the first post from that

## posts commented on by gleb

### [Nathan's tail](https://www.ruby-forum.com/posts/6)

Hi, I am a dog. Woof,woof

```
<em>Please log in to place a comment.</em>
<a href="/session/new">Login</a>

```

Submitted by: [rover](https://www.ruby-forum.com/users/4)

You have one

 tag and two 
 tags, which isn’t balanced.  
This appears to be consistent for each post.

I would guess you want that last closing div tag and not the one 4 lines  
above.

I suspect that this is in \_post.html.erb

## HTH

Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Github: [rubyredrick (Rick DeNatale) · GitHub](http://github.com/rubyredrick)  
Twitter: @RickDeNatale  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)
