mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 22:36:50 +00:00
22 lines
592 B
Ruby
22 lines
592 B
Ruby
module ActiveModelSerializers
|
|
module Adapter
|
|
class Json < Base
|
|
def serializable_hash(options = nil)
|
|
options = serialization_options(options)
|
|
serialized_hash = { root => Attributes.new(serializer, instance_options).serializable_hash(options) }
|
|
serialized_hash[meta_key] = meta unless meta.blank?
|
|
|
|
self.class.transform_key_casing!(serialized_hash, instance_options)
|
|
end
|
|
|
|
def meta
|
|
instance_options.fetch(:meta, nil)
|
|
end
|
|
|
|
def meta_key
|
|
instance_options.fetch(:meta_key, 'meta'.freeze)
|
|
end
|
|
end
|
|
end
|
|
end
|