0

我想将其转换为 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 %>

我正在获取图像上的链接。但我还需要用文本添加跨度。我试过了,但它不起作用:-

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

1 回答 1

1

尝试:

 <%= link_to raw("<span>Log out</span>") + image_tag("images/log-out.png", :border => 0 ), destroy_user_session_path, :method => :delete %>
于 2012-11-12T14:44:14.160 回答