Login
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
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.
Roast topics
Find topics
Roast it!
Roast topics
Find topics
Find it!
Roast topics
Find topics
Find it!