I'm developing a social network like a mix of Twitter and Facebook based on sports. I have a model called Post (id, user_id, receiver_id, message, created_at) and I want to cache the Post views.
app/views/posts/_post.haml
- cache post do
%div
.author= link_to post.user.full_name, post.user
.message= post.message
.timestamp= timestamp_for_post(post.created_at)
All worked perfectly yesterday but when I visited my "home feed" I realized that timestamp is cached. Let me show you an example:
Berna Castro test Less than a minute ago - Comment Props Delete
The thing is it shouldn't display "Less than a minute ago", it should display "Yesterday". Is there any way to don't cache the timestamp? What do you recommend to fix that?
I thought to make an AJAX call for getting the timestamp but that's very weird and not good.