Skip to content

Instantly share code, notes, and snippets.

@davetheninja
Created May 8, 2011 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davetheninja/961226 to your computer and use it in GitHub Desktop.
Save davetheninja/961226 to your computer and use it in GitHub Desktop.
there must be a nicer way to do this
# 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
@davetheninja
Copy link
Author

There must be a nicer way to add an element every X number of iterations of a partial collection

@davetheninja
Copy link
Author

Solution found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment