开发者

How do I access the images in rails 3.1?

开发者 https://www.devze.com 2023-04-01 22:12 出处:网络
In my sample project for the previous rails versions I would access the images as <%= image_tag(product.image_url, :class => \'list_image\') %>

In my sample project for the previous rails versions I would access the images as

<%= image_tag(product.image_url, :class => 'list_image') %>

How can I do the same in rails 3.1 sinc开发者_StackOverflow中文版e the images folder has been moved to app/assets/ ?


Links like this:

<img src="/images/my-image.jpg" />

become:

<img src="/assets/my-image.jpg" />

Rails does some magic to figure out that it's actually in the images directory. So no need to specify the images directory.

0

精彩评论

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