Adding Fragment Cache to AMS

It's an upgrade based on the new Cache implementation #693.
It allows to use the Rails conventions to cache
specific attributes or associations.
It's based on the Cache Composition implementation.
This commit is contained in:
João Moura
2015-02-03 21:57:02 -02:00
parent 48ed7cf9ba
commit 792fb8a905
19 changed files with 554 additions and 101 deletions

View File

@@ -41,6 +41,7 @@ module ActiveModel
expected = [
{
id: "43",
rating: nil,
type: "bios",
content:"AMS Contributor",
links: {

View File

@@ -1,11 +1,11 @@
require 'test_helper'
module ActiveModel
class Serializer
class Adapter
class JsonApi
class LinkedTest < Minitest::Test
def setup
ActionController::Base.cache_store.clear
@author1 = Author.new(id: 1, name: 'Steve K.')
@author2 = Author.new(id: 2, name: 'Tenderlove')
@bio1 = Bio.new(id: 1, content: 'AMS Contributor')
@@ -103,8 +103,9 @@ module ActiveModel
}
}, {
id: "1",
content: "AMS Contributor",
rating: nil,
type: "bios",
content: "AMS Contributor",
links: {
author: { linkage: { type: "authors", id: "1" } }
}
@@ -119,8 +120,9 @@ module ActiveModel
}
}, {
id: "2",
content: "Rails Contributor",
rating: nil,
type: "bios",
content: "Rails Contributor",
links: {
author: { linkage: { type: "authors", id: "2" } }
}