0

I want to convert this into ruby on rails code :

<a href="#"><span>Log out</span><%= image_tag("images/log-out.png") %></a>

When trying this one:

<%= link_to image_tag("images/log-out.png", :border => 0 ), destroy_user_session_path, :method => :delete %>

I'm getting a link on the image. But i also need to add span with text.I tried this but its not working:-

 <%= link_to "<span>Log out</span>"+image_tag("images/log-out.png", :border => 0 ), destroy_user_session_path, :method => :delete %>
Sachin Prasad
  • 5,365
  • 12
  • 54
  • 101

1 Answers1

1

Try with:

 <%= link_to raw("<span>Log out</span>") + image_tag("images/log-out.png", :border => 0 ), destroy_user_session_path, :method => :delete %>
jacoz
  • 3,508
  • 5
  • 26
  • 42
  • 1
    Thanks buddy this one worked for me. I will accept this as an answer after some time as stack won't allow me to do it now. – Sachin Prasad Nov 12 '12 at 14:50