mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
14 lines
288 B
Ruby
14 lines
288 B
Ruby
module ActiveModel
|
|
module Serializable
|
|
def as_json(options={})
|
|
if root = options[:root] || self.root
|
|
hash = { root.to_s => serializable_object }
|
|
hash[meta_key.to_s] = meta if meta
|
|
hash
|
|
else
|
|
serializable_object
|
|
end
|
|
end
|
|
end
|
|
end
|