# Partial + custom class

**URL:** <https://www.ruby-forum.com/t/partial-custom-class/157905>\
**Category:** Rails\
**Created:** [January 16, 2009, 1:47pm UTC](https://www.ruby-forum.com/t/partial-custom-class/157905 "2009-01-16T13:47:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [January 16, 2009, 1:47pm UTC](https://www.ruby-forum.com/t/partial-custom-class/157905/1 "2009-01-16T13:47:09Z")

</div>

Hi all,

I am using partial:  
\<%= render :partial =\> ‘post’, :collection =\> @posts %\>

\_post.rhtml

- _\<%= post.created\_at %\>_

this will display my last 4 posts next to each other, but each of this

- blocks have right-margin 33px and I would liko to set the last 
- block with no right-margin. What I need to do is to add to last 
- Any help would be most welcome.  
Cheers P.

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [January 16, 2009, 1:51pm UTC](https://www.ruby-forum.com/t/partial-custom-class/157905/2 "2009-01-16T13:51:36Z")

</div>

On Fri, Jan 16, 2009 at 1:47 PM, Petr B.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all,
> 
> I am using partial:  
> \<%= render :partial =\> ‘post’, :collection =\> @posts %\>
> 
> \_post.rhtml
> 
> - _\<%= post.created\_at %\>_

You can use the last method of Array to figure out if you’re on the last  
post

\<% if post == @posts.last -%\>

---

<div class="post-metadata">

**Author:** ![golf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@golf](https://www.ruby-forum.com/u/golf)\
**Post date:** [January 16, 2009, 1:58pm UTC](https://www.ruby-forum.com/t/partial-custom-class/157905/3 "2009-01-16T13:58:09Z")

</div>

> \<% if post == @posts.last -%\>

Hi Franz,

works like a charm! Thank you.

P.
