我想将它转换为ruby on rails代码:
<a href="#"><span>Log out</span><%= image_tag("images/log-out.png") %></a>
尝试这个时:
<%= link_to image_tag("images/log-out.png", :border => 0 ), destroy_user_session_path, :method => :delete %>
我正在获取图片上的链接。但是我还需要添加带有text的span。我尝试了这个但它不起作用: -
<%= link_to "<span>Log out</span>"+image_tag("images/log-out.png", :border => 0 ), destroy_user_session_path, :method => :delete %>
答案 0 :(得分:1)
尝试:
<%= link_to raw("<span>Log out</span>") + image_tag("images/log-out.png", :border => 0 ), destroy_user_session_path, :method => :delete %>