123456789_123456789_123456789_123456789_123456789_

Class: ActiveModel::NestedError

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Forwardable, Error
Instance Chain:
self, Error
Inherits: ActiveModel::Error
Defined in: activemodel/lib/active_model/nested_error.rb

Constant Summary

Error - Inherited

CALLBACKS_OPTIONS, MESSAGE_OPTIONS

Class Attribute Summary

Class Method Summary

Instance Attribute Summary

Error - Inherited

#attribute

The attribute of base which the error belongs to.

#base

The object which the error belongs to.

#i18n_customize_full_message, #i18n_customize_full_message?,
#options

The options provided when calling errors#add.

#raw_type

The raw value provided as the second parameter when calling errors#add.

#type

The type of error, defaults to :invalid unless specified.

Instance Method Summary

Error - Inherited

#detail

Alias for Error#details.

#details

Returns the error details.

#eql?

Alias for Error#==.

#full_message

Returns the full error message.

#match?

See if error matches provided attribute, type, and options.

#message

Returns the error message.

#strict_match?

See if error matches provided attribute, type, and options exactly.

Constructor Details

.new(base, inner_error, override_options = {}) ⇒ NestedError

[ GitHub ]

  
# File 'activemodel/lib/active_model/nested_error.rb', line 8

def initialize(base, inner_error, override_options = {})
  @base = base
  @inner_error = inner_error
  @attribute = override_options.fetch(:attribute) { inner_error.attribute }
  @type = override_options.fetch(:type) { inner_error.type }
  @raw_type = inner_error.raw_type
  @options = inner_error.options
end

Instance Attribute Details

#inner_error (readonly)

[ GitHub ]

  
# File 'activemodel/lib/active_model/nested_error.rb', line 17

attr_reader :inner_error