Selecting images from db according to type

Ok so this seems easy huh? So I have some images in a db. Some are
marked as “screenshots” and others as “wallpapers”. Now in various parts
of the site, I want to show only “screenshots” and in another area, only
“wallpapers”. In the db, it’s in the column marked “image_type” Here is
what I thought:

The view:

<% for screenshot in @game.images %>
<%= screenshot.id %><% end %>

and

<% for wallpaper in @game.images %>
<% end %>

The Models:

now I have “belongs_to :games” and “has_many :images”

The Controller:

@game = Game.find(params[:id])
@images = Image.find(:all)
@screenshot = Image.find(:all, :conditions => “image_type =
‘Screenshots’”)
@wallpaper = Image.find(:all, :conditions => “image_type =
‘Wallpapers’”)

now how do I do it, so that it selects only the images I want? Because
instead of selecting the image I want, it selects ALL the images for
both. Please help people, I’m so lost… I think the answer is
really easy, but I’m still learning rails, so be kind :stuck_out_tongue:

  • Jake