11
link_to图片标签。如何将类别添加到标签
我正在使用link_to img标签,如下所示 <%= link_to image_tag("Search.png", :border=>0, :class => 'dock-item'), :action => 'search', :controller => 'pages'%><span>Search</span></a> 这导致以下HTML <a href="/pages/search"><img alt="Search" border="0" class="dock-item" src="/images/Search.png?1264132800" /></a><span>Search</span></a> 我希望class =“ dock-item”转到<a>标签而不是img标签。 我该如何更改? 更新: <%= link_to image_tag("Search.png", :border=>0), :action => 'search', :controller => 'pages', :class => 'dock-item' %> 结果是 <a href="/pages/search?class=dock-item"><img alt="Search" border="0" src="/images/Search.png?1264132800" /></a>