Reputation: 3829
I want a link with text and an image. Before rails 3 internet 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?
Upvotes: 2
Views: 1841
Reputation: 83680
<%= 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 %>
Upvotes: 12