I would like to use an instance variable as the source in my image tag.
Is something like this possible? For example:
<%= image_tag(@new_image) %>
linked to an action that uses a model with:
@new_image = “some_image.jpg”
I would like to use an instance variable as the source in my image tag.
Is something like this possible? For example:
<%= image_tag(@new_image) %>
linked to an action that uses a model with:
@new_image = “some_image.jpg”
If it’s an instance variable from a model, you’ll have to go
attr_reader :thingie in the model, and
image_tag(@instance_of_model.thingie)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs