链接图像和文本在铁轨上的红宝石

时间:2012-11-12 14:41:57

标签: ruby-on-rails ruby-on-rails-3

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

1 个答案:

答案 0 :(得分:1)

尝试:

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