Rails cycle helper with a few exceptions -


i'm using rails cycle() helper method in standard way table rows make alternating rows different background colors. however, want occasional row or 2 (that match criteria) different, third color, without interrupting cycle.

in other words, want rows like:

white black red black white black white 

instead of:

white black red white black white 

what's best way this?

got store in temporary variable , make call cycle() ensure up-to-date.

<% class = cycle('white', 'black', :name => 'colors') class = 'red' if should_be_highlighted %> <tr class="<%= class %>"> 

you wrap nicely in own helper.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -