mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Remove unnecessary Adapter::Base#resource_object_for
This commit is contained in:
parent
fcfbc0d529
commit
eb86663393
@ -32,7 +32,16 @@ module ActiveModelSerializers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def serializable_hash_for_single_resource(options)
|
def serializable_hash_for_single_resource(options)
|
||||||
resource = resource_object_for(options)
|
resource =
|
||||||
|
if serializer.class.cache_enabled?
|
||||||
|
cached_attributes = instance_options[:cached_attributes] || {}
|
||||||
|
key = serializer.cache_key(self)
|
||||||
|
cached_attributes.fetch(key) do
|
||||||
|
serializer.cached_fields(options[:fields], self)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
serializer.cached_fields(options[:fields], self)
|
||||||
|
end
|
||||||
relationships = resource_relationships(options)
|
relationships = resource_relationships(options)
|
||||||
resource.merge(relationships)
|
resource.merge(relationships)
|
||||||
end
|
end
|
||||||
@ -60,18 +69,6 @@ module ActiveModelSerializers
|
|||||||
|
|
||||||
relationship_value
|
relationship_value
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_object_for(options)
|
|
||||||
if serializer.class.cache_enabled?
|
|
||||||
cached_attributes = instance_options[:cached_attributes] || {}
|
|
||||||
key = serializer.cache_key(self)
|
|
||||||
cached_attributes.fetch(key) do
|
|
||||||
serializer.cached_fields(options[:fields], self)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
serializer.cached_fields(options[:fields], self)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user