Tip: Use Rails `cycle` to avoid `i % 2 == 0` in your view loops
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”.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.
Tip: Use Rails `cycle` to avoid `i % 2 == 0` in your view loops #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/boring-rails-skip-the-bullshit-and-ship-fast