i have this piece of code here that generates a link for all of my questions from a database, but right now I have 10 entries and this loop will iterate 10 times. Is there a way to stop the iteration at a range of 4?
<table>
<tr>
<th>Question</th>
<th>Button</th>
</tr>
</tr>
<% @questions.each do |q| %>
<tr>
<td><%= q.question %></td>
<td><%= link_to 'Question', show_url(q.id), method: :get %></td>
<td><%= q.id %> Button</td>
<% end %>
</tr>
</table>
Any suggestions will be appreciated! Thanks.
Aucun commentaire:
Enregistrer un commentaire