Rails rails api 关于 image_tag,写错了吗

Season · February 19, 2013 · Last by huobazi replied at February 19, 2013 · 2620 hits

我看 railsapi 里面的例子,说 image_tag("icon.png") # => img src="/images/icon.png" alt="Icon"

但是实际情况貌似是这样的 image_tag("icon.png") # => img alt="Icon" src="/assets/icon.png"

用上面的路径读不到图片。 我 rails 是 3.2.11,是版本问题吗?还是 api 没更新?

直接写 html,如何

你启用了 assets 如果你的图片在 public/images/那你可以 <%= image_tag "/images/icon.png" %>

image_tag("/assets/icon.png")

#2 楼 @miclle 原来如此,那大家一般图片都是放在 assets 里面还是 public 里面呢

You need to Sign in before reply, if you don't have an account, please Sign up first.