开发者

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:

Why does rails 3 show "(/)" when I use the link_to img_tag helpers?

'(/)'

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜