Class: ActiveModel::NestedError

Inherits:
Error
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/active_model/nested_error.rb

Constant Summary

Constants inherited from Error

Error::CALLBACKS_OPTIONS, Error::MESSAGE_OPTIONS

Instance Attribute Summary collapse

Attributes inherited from Error

#attribute, #base, #options, #raw_type, #type

Instance Method Summary collapse

Methods inherited from Error

#==, #details, #full_message, full_message, generate_message, #hash, #initialize_dup, #inspect, #match?, #message, #strict_match?

Constructor Details

#initialize(base, inner_error, override_options = {}) ⇒ NestedError

Returns a new instance of NestedError.



8
9
10
11
12
13
14
15
# File '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_errorObject (readonly)

Returns the value of attribute inner_error.



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

def inner_error
  @inner_error
end