Sha256: 86e4dffde644a43cf6c6717bfe8470a41b0713e1db4b4161b79b78366fceb83d
Contents?: true
Size: 515 Bytes
Versions: 3
Compression:
Stored size: 515 Bytes
Contents
module ActiveModel module Serializable def as_json(options={}) if root = options.fetch(:root, json_key) hash = { root => serializable_object } hash.merge!(serializable_data) hash else serializable_object end end def serializable_data embedded_in_root_associations.tap do |hash| if respond_to?(:meta) && meta hash[meta_key] = meta end end end def embedded_in_root_associations {} end end end
Version data entries
3 entries across 3 versions & 2 rubygems