On Sep 24, 2009, at 3:08 AM, vellingiri wrote:
> how to stripe rails comments ?
> I have searched google, but i could not get proper module.
> Please
> anyone help me how to do this ?
>
> Regards
> S.Vellingiri.
Well, assuming that you meant to ask:
"How can I alternate the visual presentation of elements in a list?"
You can use the cycle() method:
<style type="text/css">
.odd { background-color: #fff; }
.even { background-color: #ccc; }
</style>
<% @comments.each do |comment| -%>
<div class="comment <%= cycle('odd','even') %>"><%= comment %></div>
<% end -%>
Please ask a better question next time (and let us know that you at
least tried to search Google for it).
-Rob
Rob Biedenharn http://agileconsultingllc.com
[email protected]
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---