Class: ActiveModel::Serializer::ErrorsSerializer
- Inherits:
-
Object
- Object
- ActiveModel::Serializer::ErrorsSerializer
- Includes:
- Enumerable
- Defined in:
- lib/active_model/serializer/errors_serializer.rb
Instance Attribute Summary (collapse)
-
- (Object) object
readonly
Returns the value of attribute object.
-
- (Object) root
readonly
Returns the value of attribute root.
Instance Method Summary (collapse)
-
- (ErrorsSerializer) initialize(resources, options = {})
constructor
A new instance of ErrorsSerializer.
- - (Object) json_key
- - (Boolean) success?
Constructor Details
- (ErrorsSerializer) initialize(resources, options = {})
Returns a new instance of ErrorsSerializer
7 8 9 10 11 12 13 14 |
# File 'lib/active_model/serializer/errors_serializer.rb', line 7 def initialize(resources, = {}) @root = [:root] @object = resources @serializers = resources.map do |resource| serializer_class = .fetch(:serializer) { ActiveModel::Serializer::ErrorSerializer } serializer_class.new(resource, .except(:serializer)) end end |
Instance Attribute Details
- (Object) object (readonly)
Returns the value of attribute object
5 6 7 |
# File 'lib/active_model/serializer/errors_serializer.rb', line 5 def object @object end |
- (Object) root (readonly)
Returns the value of attribute root
5 6 7 |
# File 'lib/active_model/serializer/errors_serializer.rb', line 5 def root @root end |
Instance Method Details
- (Object) json_key
20 21 22 |
# File 'lib/active_model/serializer/errors_serializer.rb', line 20 def json_key nil end |
- (Boolean) success?
16 17 18 |
# File 'lib/active_model/serializer/errors_serializer.rb', line 16 def success? false end |