开发者

Rails ActionController::UnknownAction for favicon

I have following line in my app/views/layouts/application.html.erb

<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />

This somehow causes following error message int he logs and the favicon is not loaded. This happens only for certain paths not for the whole 开发者_开发问答application.

ActionController::UnknownAction (No action responded to images. Actions: 

How to get rid of it ?


Use the favicon_link_tag helper instead:

<%= favicon_link_tag "/favicon.ico" %>

Just make sure your favicon.ico file is in the public folder... and do not forget the forward slash.


Believe me.. try prefixing images with a slash and this should work

<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜