Link_to with raw included

I want to allow the path upload.img_path in my link. upload.img_path is
a path to an image.

<%= raw upload.img_path %>

correctly displays the image.

But, I can’t figure out how to do this with a link.

<%= link_to raw(upload.img_path, upload) %> gives the error:
wrong number of arguments (2 for 1)

<%= link_to (upload.img_path, upload, :raw => true) %> For this,
the link works but the image is escaped. The image path is displayed
instead of of the image.

I think you want:

<%= link_to raw(upload.img_path), upload %>

No?

Phil

Phil C. wrote in post #979960:

I think you want:

<%= link_to raw(upload.img_path), upload %>

No?

Phil

<%= link_to raw(upload.img_path), upload %>
That works.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs