Class: ViewModel::ErrorView

Inherits:
Record show all
Defined in:
lib/view_model/error_view.rb

Overview

ViewModel for rendering ViewModel::AbstractErrors

Defined Under Namespace

Classes: ExceptionDetailView

Constant Summary

Constants inherited from ViewModel

BULK_UPDATES_ATTRIBUTE, BULK_UPDATE_ATTRIBUTE, BULK_UPDATE_TYPE, ID_ATTRIBUTE, MIGRATED_ATTRIBUTE, NEW_ATTRIBUTE, REFERENCE_ATTRIBUTE, TYPE_ATTRIBUTE, VERSION_ATTRIBUTE

Instance Attribute Summary

Attributes inherited from Record

#changed_attributes, #model, #previous_changes

Instance Method Summary collapse

Methods inherited from Record

#==, attribute, #attribute_changed!, #changed_nested_children?, #changed_referenced_children?, #changes, #clear_changes!, deserialize_from_view, deserialize_members_from_view, for_new_model, #hash, #id, inherited, #initialize, initialize_as_viewmodel_record, member_names, model_class, #model_is_new!, #nested_children_changed!, #new_model?, #referenced_children_changed!, resolve_viewmodel, #serialize_members, #serialize_view, should_register?, #stable_id?, #validate!

Methods inherited from ViewModel

#==, accepts_schema_version?, add_view_alias, attribute, attributes, #blame_reference, #context_for_child, deserialization_includes, deserialize_context_class, deserialize_from_view, deserialize_members_from_view, eager_includes, encode_json, extract_reference_metadata, extract_reference_only_metadata, extract_viewmodel_metadata, #hash, #id, inherited, #initialize, initialize_as_viewmodel, is_update_hash?, lock_attribute_inheritance, member_names, #model, new_deserialize_context, new_serialize_context, preload_for_serialization, #preload_for_serialization, root!, root?, schema_hash, schema_versions, #serialize, serialize, serialize_as_reference, serialize_context_class, serialize_from_cache, serialize_to_hash, #serialize_to_hash, #serialize_view, #stable_id?, #to_json, #to_reference, #validate!, #view_name

Constructor Details

This class inherits a constructor from ViewModel::Record

Instance Method Details

#serialize_exception(json, serialize_context:) ⇒ Object

Ruby exceptions should never be serialized in production



37
38
39
40
41
42
43
# File 'lib/view_model/error_view.rb', line 37

def serialize_exception(json, serialize_context:)
  if ViewModel::Config.show_cause_in_error_view
    super
  else
    json.exception nil
  end
end