Why does rails 3 show "(/)" when I use the link_to img_tag helpers?
here's the code:
<%= link_to tag("img"开发者_Python百科, { :src => "/images/logo.png", :alt => "logo"}, false), {:controller => 'frontpage', :action => 'index'}, :class => "logo" %>
the output:
'(/)'
the '(/)' --minus the quotes, come at the end of the image
Are you sure you don't have that floating in your HTML somewhere?
Also, you're doing a lot more work than necessary:
<%= link_to image_tag('logo.png'), frontpages_path, :class => 'logo' %>
That'll automatically assign "Logo" as the alt text, and assuming you're using RESTful routes, that frontpages_path
helper will already exist.
精彩评论