Paperclip image url

后端 未结 1 745
鱼传尺愫
鱼传尺愫 2020-12-05 17:43

Stupid question?

\"Phone_large\"

Why is \"?1238845838\" added t

相关标签:
1条回答
  • 2020-12-05 18:10

    It's commonly referred to as a "cache buster". Paperclip automatically appends the timestamp for the last time the file was updated.

    Say you were to remove the cache buster and use /system/photos/1/small/phone_large.jpg instead. The URL wouldn't change when you changed the image and your visitors would see the old image for as long as they had it cached.

    If you want to remove it just call .url(:default, timestamp: false). Of course you can change :default to any other style you've defined.

    Or if you want to globally default them to off, just put this in a config/initializers/paperclip.rb file.

    Paperclip::Attachment.default_options[:use_timestamp] = false
    
    0 讨论(0)
提交回复
热议问题