I'm using Rails + Paperclip + S3. I'm looking to host my assets to Cloudfront using one of my S3 buckets.
I know that Cloudfront caches assets but that you can break that cache by configuring it to forward query strings from the origin.
When I modify an asset I expect this to happen
- The
updated_attimestamp of the ActiveRecord object is updated. - Paperclip updates the query string of the image on S3 to reflect the new
updated_attime. - Cloudfront serves the new image because of the new timestamp query string.
However, it looks like Paperclip isn't properly updating the updated_at timestamp. Maybe it's cached somehow. Therefore the query string doesn't update and Cloudfront never breaks the cache.
My model is:
class UserImage < ActiveRecord::Base
has_attached_file :image
end
>> ui = UserImage.find(576925)
>> ui.image.class
=> Paperclip::Attachment
>> ui.touch
>> ui.updated_at.to_i
=> 1386241041
>> ui.image.updated_at
=> 1386240937
Those two updated_at timestamps should be the same.