In my app, i'm storing the name of images in the database, and keeping
the images in the /images folder. The index.html.erb for my view uses
an image tag:
which shows up correctly. attempting to show the same icon in the
show.html.erb doesn't show the image. adding a border to it shows a
line about the size of a 'pipe command' and then the name.
i've been trying different formats for the last 3 hours with no success.
is there a difference in the references for the two files? or is the
icon just being squashed somehow? I'm using firefox2 on ubuntu 7.10 if
that helps.
You can use image_tag(h.reagent.icon) and that'll work instead of <img
src=<%= h.reagent.icon %> />
I've only just started using Rails this week, so I'm pretty well lost,
as the tutorials i've followed just say "click this then this and it's
done" instead of delving into why things are done. I've tried several
variations of inserting your suggestion into the file, but with no
success. The API listing on railsbrain.com only shows it used for
absolute references, not variable references, so i'm stumped.
The first one causes an error (wrong number of arguments (0 for 1)) and
the second one only writes the text of that line to the page. All of
the other references to reagent on the show.html.erb code use <%=h
@reagent.<item> =%> and successfully call their data.
Ok, i had a burst of inspiration whilst on the 'throne' =P
I looked at the page source from the rendered version and saw that the
img tag didn't include the /images/ prefix that i used in the
index.html.erb file.