Method: ActiveModel::Errors#copy!

Defined in:
activemodel/lib/active_model/errors.rb

#copy!(other) ⇒ Object

Copies the errors from other. For copying errors but keep @base as is.

Parameters

  • other - The ActiveModel::Errors instance.

Examples

person.errors.copy!(other)


138
139
140
141
142
143
# File 'activemodel/lib/active_model/errors.rb', line 138

def copy!(other) # :nodoc:
  @errors = other.errors.deep_dup
  @errors.each { |error|
    error.instance_variable_set(:@base, @base)
  }
end