I sometimes use the Blueprint CSS framework for development. The problem is that if you want to generate a grid using Blueprint or similar frameworks, you have to assign a class of “first” to the first element in each row, and a class of “last” to the last element in each row.
This is a nice way to get the job done. It uses a helper method that returns “first” or “last” based on the index of the array with the elements, and the number of columns that is passed as an argument.
Put this in your helper file
In your view, instead of writing
you write:
Let me know if you have any questions.
Follow @azolotov
{ 1 comment… read it below or add one }
Hey there,
nice article! You can use Enumerable#each_with_index instead of Array#each_index:
<div class="span-8 “>
# your code