Sunday, February 6, 2011

[Rails] 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.

[code]
<%= raw upload.img_path %>
[/code]
correctly displays the image.

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


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

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

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate