Last active
December 26, 2015 01:59
-
-
Save blairanderson/7075515 to your computer and use it in GitHub Desktop.
rendering a collection to a partial, but I want to have the layout be different for even and odd records that are rendered out. https://gist.github.com/blairanderson/7075515
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
<% if thing_counter.even? %> | |
<div class="wide"> | |
<h2>Header</h2> | |
<p class="lead"></p> | |
</div> | |
<div class="narrow"> | |
<%= image_tag thing.image %> | |
</div> | |
<% else %> | |
<div class="narrow"> | |
<%= image_tag thing.image %> | |
</div> | |
<div class="wide"> | |
<h2>Header</h2> | |
<p class="lead"></p> | |
</div> | |
<% end %> |
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
<%= render partial: 'thing', collection: @some_pictures_or_things %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment