ruby on rails - How to add a class to a render :partial => @collection on every 4th item? -
Assume that I have 16 results
On every 4th item I got a class " Margin "(because on the left one margin is required to make each item different, but the last time this will break the layout, thus its requirement).
What is the best way to do this? / P>
I have this very rail-like.
Render: partial = & gt; @ Collection__collection.html .html Accessories
Is there anything I can keep partially that will solve it or will it be excluded?
Thank you.
When you present a collection, the rail creates hidden indices. In this case, You can add the module with the index to get it.
# _partial.html.erb Even better, remove the logic in a Helper method.
Note. Counter's Name & lt; Partial_name & gt; _counter
.
Comments
Post a Comment