This may take some explanation so do bear with me.
I’m trying to access an image in Rails stored with Paperclip. The images can be accessed perfectly in a for loop, thus:
for a in @issue.articles
image_tag a.image.url
end
Do note that @issue has no articles method; I’m not sure why that works. It does, however, have article1, article2, and article3; and each of those has the image in question.
If I try to access the image outside the loop with this code it fails, thus:
image_tag @issue.article1.image.url
Any advice would be hugely appreciated.
I believe the correct way is
or for each of them