In rails 3 how do you have text and image in link_to?
I want a link with text and an image. Before rails 3 i开发者_JS百科nternet tells me that you must do :
<%= link_to "my text"+image_tag("image.jpg"), {:controller=>:billets}, :class => 'link_to_blog'%>
However in rails 3 i have the code of the image displayerd in my web page instead of the image. Seems now, it escape the html code.
How can i do a link_to with text and image in rails 3?
<%= link_to ("my text"+image_tag("image.jpg")).html_safe, {:controller=>:billets}, :class => 'link_to_blog'%>
Or
<%= link_to {:controller => :billets}, :class => 'link_to_blog' do %>
My text
<%= image_tag "image.jpg" %>
<% end %>
精彩评论