-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fragment Caching + ActiveModel::Serializer::Type #1457
Comments
I believe I could fix this by modifying FragmentCache around L#97 to be: cached.constantize.cache(klass._cache_options)
cached.constantize.type(klass._type) The first line is already there to proxy forward the _cache_options but that is the only internal setting that is handled. I also see a few other possible problems similar to
|
Do not see a clean way to ensure that any serializer DSL settings such as |
Actually the above almost works but not quite because I guess we wind up using |
I have a fix for this in #1458 |
I am using the
type
class method provided byActiveModel::Serializer::Type
to override the type for a certain serializer. This works fine with normal AMS caching. As soon as I add theexcept
keyword on my cache call (triggering Fragment Caching), the class-level type setting in my serializer gets ignored and it reverts to inferring the type from the serialized object's class.This does not seem to be expected behavior. I am trying to dig into FragmentCache adapter (I was surprised this was an adapter) to see what is going on. It looks like we dynamically create cached and non-cached serializers when fragment caching is invoked and my current best guess without having completed my investigation is that the class attribute
type
sets on the actual serializer is not being pulled forward into the generated fragment cache serializers... but I'm not sure yet.The text was updated successfully, but these errors were encountered: