mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Fixed fragment_cached? method to check if caching
I noticed that fragment caching does not actually check if caching is enabled as it seemingly should. The way CachedSerializer#fragment_cached? worked previously would return true even in an environment where caching was disabled as defined by `ActiveModelSerializers.config.perform_caching`. Added check for `_cache` like in the `cached?` method before checking whether `_cache_only` or `_cache_except` is set. There were no existing tests for any of these methods but it's a pretty trivial change.
This commit is contained in:
parent
65093055d6
commit
3a092c9b4b
@ -24,7 +24,7 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def fragment_cached?
|
||||
@klass._cache_only && !@klass._cache_except || !@klass._cache_only && @klass._cache_except
|
||||
@klass._cache && (@klass._cache_only && !@klass._cache_except || !@klass._cache_only && @klass._cache_except)
|
||||
end
|
||||
|
||||
def cache_key
|
||||
|
||||
Loading…
Reference in New Issue
Block a user