Created
May 8, 2011 08:35
-
-
Save davetheninja/961226 to your computer and use it in GitHub Desktop.
there must be a nicer way to do this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# updated solution | |
#in the view | |
= render :partial => "element", :collection => @elements | |
#in the partial | |
- if element_counter % 2 == 1 | |
.break | |
# vs. | |
- i = 0 | |
- @elements.each do |element| | |
= render element | |
- if i % 2 == 1 | |
.break | |
- i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There must be a nicer way to add an element every X number of iterations of a partial collection