Forum: Ruby on Rails render :partial

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A00673345921ae8c2e5570d1bd48b2e2?d=identicon&s=25 J. mp (lerias)
on 2007-04-03 14:25
Hi,

I'm using
<%=render :partial =>"comment/post_comment"
,:collection=>@post.comments%>

to render all comments of a post, but how do I know inside the partial
html if a the entry is even or odd, i.e, I need to have the zebra
effect.

Thnaks,

jp
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (au5lander)
on 2007-04-03 14:36
(Received via mailing list)
just use the cycle() helper method

ex:

<li class="<%= cycle("even", "odd") -%>"> ... </li>

http://api.rubyonrails.org/classes/ActionView/Help...
This topic is locked and can not be replied to.