Topic: Images with for loops
I guess a bit more Ruby than Rails,
So I have four columns in my table called img0, img1, img2, and img3. The columns may or may not contain an actual img.
I would like to have a for loop in my view that will check first to see if the field is nil and if not %= the filename.
My pseudo-code:
@num = 0
for num < 3
item.img[num].nil?
if true
image_tag(item.img[num])
num + 1
else
num + 1
end
end
Am I on the right track? Is there a better way to do this? Should I put this into a controller as a method?
Last edited by kidhero (2006-11-29 11:09:53)