开发者

Browser Caching with Paperclip

I have a quite long 开发者_JAVA百科slideshow of images, all rendered via the awesome Paperclip. Those images won't change very often, so I'd like to make use of browser caching. Problem is Paperclip appends a unique load id to the image url. (eg: pancakes.png?1275839986)

Is there any way to prevent this from happening?

Thanks!


When specifying the image url using:

UrModel.image.url(:style)
# results in: /system/model/000/001/style/style.png?<atimestamp>

Pass in a second parameter which indicates whether or not to include the timestamp:

UrModel.image.url(:style, false)
# results in: /system/model/000/001/style/style.png

Read more about paperclips caching helper: https://github.com/thoughtbot/paperclip/wiki/Tips


That numeric suffix is stored in the database itself by paperclip and is not unique per page load. It's there for caching reasons, actually.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜