Skip to content

Conversation

@Drowze
Copy link
Contributor

@Drowze Drowze commented Oct 16, 2024

Fixes #114

Rail.application was always evaluating to nil before as the code wasn't running in an initializer.

I changed the approach slightly to be less intrusive: now we simply initialize the cache store with a non-deprecated serializer, instead of modifying the ActiveSupport.cache_format_version configuration.


NOTE: after my change, if the user is on Rails >= 7 and didn't configure ActiveSupport::Cache.format_version, if they manually change the store (e.g.: Rails.application.config.graphql_fragment_cache = :memory_store), that will raise a ActiveSupport warning.
I believe this behaviour is appropriate - the user should set an appropriate cache_format_version before setting the cache store.

`Rail.application` was always evaluating to `nil` before as the code wasn't
running in an initializer.

As a fix, instead simply provide a non-deprecated serializer to the
initialized cache_store when in test environment (and where the code
would raise a warning otherwise). Also move this block to a proper Rails
initializer.
Copy link
Owner

@DmitryTsepelev DmitryTsepelev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's try it out 🙂

@DmitryTsepelev DmitryTsepelev merged commit fc2f64c into DmitryTsepelev:master Oct 19, 2024
19 checks passed
r7kamura added a commit to r7kamura/graphql-ruby-fragment_cache that referenced this pull request Oct 28, 2024
DmitryTsepelev pushed a commit that referenced this pull request Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rails 7.1 deprecation notice for cache_format_version in Rails test environment

2 participants