Sounds like a bug. Can you move into an issue?


On Thu, Oct 24, 2019 at 7:52 PM Marc Köhlbrugge <h...@marckohlbrugge.com>
wrote:

> I'm running into a problem when using fragment caching with active record
> collections.
>
> Rails 6 uses a combination of collection.cache_key and
> collection.cache_version to determine whether a fragment cache is fresh or
> not. However, there is a scenario where the collection might change while
> collection.cache_key and collection.cache_version stay the same.
>
> It happens when you use a limit on the collection and then destroy one of
> those records, as long as it's not the most recent one. This way
> collection.cache_key will stay the same, because the query does not change.
> And collection.cache_version will stay the same as well, because the
> collection count will remain unchanged as does the maximum updated_at
> timestamp of the most recent record.
>
> I've build a sample app for demonstration purposes:
>
> https://github.com/marckohlbrugge/rails-6-collection-caching-bug
>
> The readme describes a way to reproduce the issue via the website itself,
> or the Rails console.
>
> Would this be considered a bug or expected behavior? Are there any known
> work arounds?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-core/4cc0ae69-c736-48d0-bd84-8b3f44dc879d%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-core/4cc0ae69-c736-48d0-bd84-8b3f44dc879d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Richard Schneeman
https://www.schneems.com

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-core/CAFA5uRNRZQh2PiZ5uNoiBcbz5oj11FJhOurjJLmfwPkP%3D7Bo%3DA%40mail.gmail.com.

Reply via email to