I have an array of images that I want to shuffle and only show the first ten results. I am having trouble figuring out how to do that.
Here is my code
<% @images.each.shuffle do |image| %>
<tr>
<td><%= image.name %></td>
<td> <%= image_tag image.picture.url %></td>
<td><%= image.likes %></td>
<td><%= link_to 'Show', image %></td>
<td><%= link_to 'Edit', edit_image_path(image) %></td>
<td><%= link_to 'Destroy', image, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>