Ask A Question

Notifications

You’re not receiving notifications from this thread.

Caching with Etags Discussion

Discussion for Caching with Etags

Can I use this with associations in views?
I have post with author and use fresh_when on post. If I change author will it render on post view old author or new one?

Reply

Hi, the documentation states it uses updated_at to set the last_modified in the response. So as long as your Post gets updated as the author gets updated, this should work.

Reply

Does it make sense using this for an index page if it has pagination?

Reply

So basically this tells browsers that have already downloaded a copy of this version of this URL - hey, the URL has not changed?

Or this caches the whole page on Rails side and re-sends the Rails' HTML to the browser?

Reply

Hey Chris, thank you so much for making this tutorial :)

This post illustrates one the drawbacks of this solution that I could think of.
However, it was written in 2012. Is this still a vaild concern in rails 6/7?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 81,842+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.