Sha256: d5a51e5f67b6b16deb94f924162ddb4d3c904654610b3d12e035d0a8d004ab82

Contents?: true

Size: 610 Bytes

Versions: 3

Compression:

Stored size: 610 Bytes

Contents

require 'active_model/serializer/error_serializer'
class ActiveModel::Serializer::ErrorsSerializer
  include Enumerable
  delegate :each, to: :@serializers
  attr_reader :object, :root

  def initialize(resources, options = {})
    @root = options[:root]
    @object = resources
    @serializers = resources.map do |resource|
      serializer_class = options.fetch(:serializer) { ActiveModel::Serializer::ErrorSerializer }
      serializer_class.new(resource, options.except(:serializer))
    end
  end

  def success?
    false
  end

  def json_key
    nil
  end

  protected

  attr_reader :serializers
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_model_serializers-0.10.1 lib/active_model/serializer/errors_serializer.rb
active_model_serializers-0.10.0 lib/active_model/serializer/errors_serializer.rb
active_model_serializers-0.10.0.rc5 lib/active_model/serializer/errors_serializer.rb