Only set cache_versioning to true on rails versions when relevant

This commit is contained in:
cintamani 2018-10-01 15:08:57 +01:00
parent 7f751fc1f7
commit 70604bbae7

View File

@ -151,8 +151,11 @@ module ActiveModelSerializers
@blog_serializer = BlogSerializer.new(@blog) @blog_serializer = BlogSerializer.new(@blog)
end end
def test_expire_of_cache def test_expiring_of_cache_at_update_of_record
if ARModels::Author.respond_to?(:cache_versioning)
ARModels::Author.cache_versioning = true ARModels::Author.cache_versioning = true
end
author = ARModels::Author.create(name: 'Foo') author = ARModels::Author.create(name: 'Foo')
author_json = AuthorSerializerWithCache.new(author).as_json author_json = AuthorSerializerWithCache.new(author).as_json