Class: ActiveModel::Serializer::ErrorSerializer

Inherits:
ActiveModel::Serializer show all
Defined in:
lib/active_model/serializer/error_serializer.rb

Constant Summary

Constant Summary

Constants inherited from ActiveModel::Serializer

SERIALIZABLE_HASH_VALID_KEYS, UndefinedCacheKey, VERSION

Constants included from Caching

Caching::CALLER_FILE

Instance Attribute Summary

Attributes inherited from ActiveModel::Serializer

#object, #root, #scope

Instance Method Summary (collapse)

Methods inherited from ActiveModel::Serializer

adapter, get_serializer_for, include_directive_from_options, #initialize, #json_key, #read_attribute_for_serialization, #relationship_value_for, #resource_relationships, #serializable_hash, serialization_adapter_instance, serializer_for, serializer_lookup_chain_for, serializers_cache

Methods included from ActiveModelSerializers::Deprecate

delegate_and_deprecate, deprecate

Methods included from Caching

#cache_key, #fetch, #fetch_attributes, #fetch_attributes_fragment, #object_cache_key, #serializer_class

Methods included from Associations

#associations

Constructor Details

This class inherits a constructor from ActiveModel::Serializer

Instance Method Details

- (Hash<field_name,Array<error_message>>) as_json

Returns:

  • (Hash<field_name,Array<error_message>>)


3
4
5
# File 'lib/active_model/serializer/error_serializer.rb', line 3

def as_json
  object.errors.messages
end

- (Boolean) success?

Returns:

  • (Boolean)


7
8
9
# File 'lib/active_model/serializer/error_serializer.rb', line 7

def success?
  false
end