I have something like this in the controller:
@puzzleGames = Game.where("category = 'puzzle'").limit(8)
but in the view I display them in 2 seperate areas, 4 in one and 4 in the other.
Instead of doing something like this:
<% @puzzleGames.each do |puzzleGame| %>
to loop through all elements, is it possible to loop to and from a finite number (0-3,4-7)?
Thanks
You can also try with this
Then use
@gameSlices.firstand@gameSlices.lastEDIT: Just turned out that
@gameSlices.nextcan be very useful in this case. It will return each slice one by one.or you can use a block like