Repeat two blocks of code of same db under dif conditions

I have some images connected with some db settings in my app. I want to
get all the images from DB into two different section, one for
screenshots and one for wallpapers. In the db, each image has an
attribute image_type which defines which one it is. So I thought to put
this code into the view:

<% @game.images.each do |screenshot| %>
<% @game.images.each do |wallpaper| %>

After some research, I found out that I didn’t actually understand what
I was doing at the time. So how can I do it (properly and not noobish
like I did here) and get two separate sections with each getting a bunch
of images of a certain type??? Thx a lot -Jake