Different Updated At Date Depending on Context
-
30-06-2021 - |
Pergunta
When I access my data for a particular model in a list context, the updated_at date hasn't changed, however, when I access the same record in a individual (show) context, the date does appear to be changed.
List Context
Show Context
I am using jbuilder for the JSON views. They look like this:
List Context (index.json.jbuilder)
json.array! @media_files do |json, media_file|
json.(media_file, :id, :name, :description, :category_id, :mime, :media_file_type_id, :size, :shareable, :deleted, :keywords, :updated_at, :version)
json.url signed_url(media_file.url)
json.thumb_url signed_url(media_file.thumb_url)
end
Show Context (show.json.jbuilder)
json.(@media_file, :id, :name, :description, :category_id, :mime, :media_file_type_id, :size, :shareable, :deleted, :keywords, :updated_at, :version)
json.url signed_url(@media_file.url)
json.thumb_url signed_url(@media_file.thumb_url)
Any idea what might be causing that?
Solução
So I ended up just disabling caching in production. That's my temporary fix. I would love to hear some feedback as to a better way to fix this issue as this is really just a workaround.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow