Partial + custom class


#1

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
  • block to not to set the right margin.

    Any help would be most welcome.
    Cheers P.


  • #2

    On Fri, Jan 16, 2009 at 1:47 PM, Petr B.
    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 -%>


    #3

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

    Hi Franz,

    works like a charm! Thank you.

    P.