mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Test caching with fragmented key
- on association, fix up assocation logic - on attribute
This commit is contained in:
11
test/fixtures/poro.rb
vendored
11
test/fixtures/poro.rb
vendored
@@ -136,10 +136,11 @@ AuthorSerializer = Class.new(ActiveModel::Serializer) do
|
||||
end
|
||||
|
||||
RoleSerializer = Class.new(ActiveModel::Serializer) do
|
||||
cache only: [:name], skip_digest: true
|
||||
attributes :id, :name, :description, :slug
|
||||
cache only: [:name, :slug], skip_digest: true
|
||||
attributes :id, :name, :description
|
||||
attribute :friendly_id, key: :slug
|
||||
|
||||
def slug
|
||||
def friendly_id
|
||||
"#{object.name}-#{object.id}"
|
||||
end
|
||||
|
||||
@@ -153,10 +154,10 @@ LikeSerializer = Class.new(ActiveModel::Serializer) do
|
||||
end
|
||||
|
||||
LocationSerializer = Class.new(ActiveModel::Serializer) do
|
||||
cache only: [:place], skip_digest: true
|
||||
cache only: [:address], skip_digest: true
|
||||
attributes :id, :lat, :lng
|
||||
|
||||
belongs_to :place
|
||||
belongs_to :place, key: :address
|
||||
|
||||
def place
|
||||
'Nowhere'
|
||||
|
||||
Reference in New Issue
Block a user