mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fcd1e41e82
Mark private constants Display alternative for deprecation removal warning Annotate Error's attributes More emphasis on adding an error instead of message Rewrite scaffold template using new errors API Set first and last with behavior change deprecation Update more doc and example Add inspect for easier debugging
22 lines
579 B
Ruby
22 lines
579 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "active_model/error"
|
|
require "forwardable"
|
|
|
|
module ActiveModel
|
|
class NestedError < Error
|
|
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
|
|
|
|
attr_reader :inner_error
|
|
|
|
extend Forwardable
|
|
def_delegators :@inner_error, :message
|
|
end
|
|
end
|