Hi all,
I am using partial:
<%= render :partial => ''post'', :collection => @posts
%>
_post.rhtml
<li>
<p class="date"><em><%= post.created_at
%></em></p>
.
.
</li>
this will display my last 4 posts next to each other, but each of this
<li> blocks have right-margin 33px and I would liko to set the last
<li>
block with no right-margin. What I need to do is to add <li
class="last"> to last <li> block to not to set the right
margin.
Any help would be most welcome.
Cheers P.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Fri, Jan 16, 2009 at 1:47 PM, Petr Bobek <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi all, > > I am using partial: > <%= render :partial => ''post'', :collection => @posts %> > > _post.rhtml > > <li> > <p class="date"><em><%= post.created_at %></em></p>You can use the last method of Array to figure out if you''re on the last post <% if post == @posts.last -%> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <% if post == @posts.last -%>Hi Franz, works like a charm! Thank you. P. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---