Associations I exo 4 From where does the variable image_tag come from?


In the exercice 4 where we are asked to create a loop in the view in order to display the tag image and the tag title,
I tried to this

<img src="<%t.image%>">

but this never worked and the solution was :

<%= image_tag t.image %>

Ok I was close but I don’t remember having defined the image_tag variable.


Hi Cedlemo,

image_tag isn’t a variable, and it’s not something you create - Rails automatically creates image_tag for you :slight_smile: