A find to key pair

I would like to get an array/hash where I can write @image[88] and that
would result in "thisimage.jpg". I've got:

@images = Image.find(:all, :select => "id, real_file_name")
result = {}
@images.map {|a| result[a.id] = a.real_file_name }

I think this is correct, but I don't know how to get the result from it.
It doesn't work with @images[88]. What am I doing wrong?

There may be a more railsey way, but this is a basic Ruby way that should work

@images = Image.find(:all, :select => "id, real_file_name")
@image_map = {} # <--- should be a better name for this
@images.each do |this_image|
   @image_map.store(this_image.id, this_image.real_file_name)


-- gw

Greg Willits wrote: