Login
Roast topics
Find topics
Find it!
From:
Boring Rails: Skip the bullshit and ship fast |
(Uncensored)
subscribe
Use Rails `cycle` to avoid `i % 2 == 0` in your view loops
https://boringrails.com/tips/rails-cycle-for-view-loops
links
backlinks
Tagged with:
ruby
rails
Roast topics
Find topics
Roast it!
Sometimes you need to keep track of how many times you’ve looped when rendering some views, for instance to alternate background colors to create a “striped” table.