Merge pull request #94 from teeparham/array-serializer-root

Add root option to ArraySerializer
This commit is contained in:
José Valim
2012-07-21 00:38:18 -07:00
3 changed files with 59 additions and 6 deletions

View File

@@ -29,11 +29,18 @@ module ActiveModel
# Active Model Array Serializer
#
# It serializes an array checking if each element that implements
# It serializes an Array, checking if each element that implements
# the +active_model_serializer+ method.
#
# To disable serialization of root elements, in an initializer:
#
# ActiveModel::ArraySerializer.root = false
#
class ArraySerializer
attr_reader :object, :options
class_attribute :root
def initialize(object, options={})
@object, @options = object, options
end