Is it possible to add HTML (such as an img tag) to link_to helper in rails3?
I see it being escaped, and in this case want to avoid that for a certain link. Or is the only way to build the link with HTML and ERB?
link_to("#{image_tag(@image.image.mini.url)} Next", @image.next_image, :class => "scroll next") if @image.next_image
EDIT: realising it may be my str开发者_如何学Going-building that causes the problem, added my code to illustrate.
This?
= link_to @image.next_image do
<span> hey ya'll i'm some html! </span>
Use .html_safe
.
link_to("#{image_tag(@image.image.mini.url)} Next".html_safe, @image.next_image, :class => "scroll next") if @image.next_image
精彩评论