Image_tag

I have an table with a background image but I do not know how to load
the image.

In general I use a code line like


but this do not work, because the directory changes, for example if I
open a sub page of my controller, the picture is gone. Please just tell
me how to use the image_tag with the background tag in html.

Regrades Snoop1990

Image tag generates <img src=> i’m pretty sure.

Why are you doing …/? Just make it /

On Feb 14, 3:54 pm, Snoop1990 Snoop1990 <rails-mailing-l…@andreas-

I have an table with a background image but I do not know how to load
the image.

In general I use a code line like


but this do not work, because the directory changes, for example if I
open a sub page of my controller, the picture is gone. Please just tell
me how to use the image_tag with the background tag in html.

image_path(“edit.png”) # => /images/edit.png
image_path(“icons/edit.png”) # => /images/icons/edit.png
image_path("/icons/edit.png") # => /icons/edit.png

Philip H. wrote:

image_path(“edit.png”) # => /images/edit.png
image_path(“icons/edit.png”) # => /images/icons/edit.png
image_path("/icons/edit.png") # => /icons/edit.png

I tried <td height=“150” background=" <=%image_path(“1.png”)%> ">
but it does not work ! How to tell ruby on rails it should render the
command when using it inside a html command ?

">

Well, it’s supposed to be <%=, but that was probably a typo.

On Feb 14, 4:27 pm, Snoop1990 Snoop1990 <rails-mailing-l…@andreas-

Steve wrote:

From your example, it looks like you’ve got double quotes (") nested
inside other double quotes.

Have you tried:

-Steve

Thank you very much, it is all working now !
Regrades Snoop1990

From your example, it looks like you’ve got double quotes (") nested
inside other double quotes.

Have you tried:

-Steve