Hi, sorry for this rather simplistic question, but I can’t think of a
good way of googling the answer (just been trying for 20 mins).
Anyway… so I have this rather simplistic piece of code:
<% for artwork in @artworks %>
<% if artwork.medium_id %>
<% medium = Medium.find(artwork.medium_id) %>
<% end %>
<% if medium %>
<%= medium.name %>
<% end %>
<% end %>
There are 6 artworks, but only the first one has a medium_id, the others
are not set. When the code runs the medium is picked up in the first
iteration of the loop, and then printed each subsequent iteration.
I naively assumed that “medium” would be destroyed at the end of each
loop, but it seems I was wrong. Is there any way for me to force its
destruction?
cheers,
ali