Sha256: 87c79b1e1eadac157a79856c11e0c80a4a182bbbf0ac98aafd7ec520916758dd

Contents?: true

Size: 592 Bytes

Versions: 12

Compression:

Stored size: 592 Bytes

Contents

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

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
active_model_serializers-0.10.8 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.7 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.6 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.5 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.4 lib/active_model_serializers/adapter/json.rb
agi_active_model_serializers-0.10.9 lib/active_model_serializers/adapter/json.rb
agi_active_model_serializers-0.10.8 lib/active_model_serializers/adapter/json.rb
agi_active_model_serializers-0.10.7 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.3 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.2 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.1 lib/active_model_serializers/adapter/json.rb
active_model_serializers-0.10.0 lib/active_model_serializers/adapter/json.rb