disable root as flag option

This commit is contained in:
João Moura 2015-06-13 15:22:43 -03:00
parent c8fcb60a5d
commit 1c3a180a20
2 changed files with 5 additions and 13 deletions

View File

@ -145,14 +145,6 @@ module ActiveModel
adapter_class
end
def self._root
@@root ||= false
end
def self._root=(root)
@@root = root
end
def self.root_name
name.demodulize.underscore.sub(/_serializer$/, '') if name
end
@ -162,7 +154,7 @@ module ActiveModel
def initialize(object, options = {})
@object = object
@options = options
@root = options[:root] || (self.class._root ? self.class.root_name : false)
@root = options[:root]
@meta = options[:meta]
@meta_key = options[:meta_key]
@scope = options[:scope]
@ -176,7 +168,7 @@ module ActiveModel
end
def json_key
if root == true || root.nil?
if root.nil?
self.class.root_name
else
root

View File

@ -8,10 +8,10 @@ module ActiveModel
super
@result
end
end
def fragment_cache(cached_hash, non_cached_hash)
Json::FragmentCache.new().fragment_cache(cached_hash, non_cached_hash)
def root
false
end
end
end
end