Sha256: 41fdd9cb02af3168b21a9484624f89940ec5e260cbc2dbd58afe86062b00ba41

Contents?: true

Size: 411 Bytes

Versions: 1

Compression:

Stored size: 411 Bytes

Contents

module ActiveModel
  module Serializable
    def as_json(options={})
      if root = options[:root] || self.root
        hash = { root => serializable_object }
        hash.merge!(serializable_data)
        hash
      else
        serializable_object
      end
    end

    def serializable_data
      if respond_to?(:meta) && meta
        { meta_key => meta }
      else
        {}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_model_serializers_rails_2.3-0.9.0.pre1 lib/active_model/serializable.rb