instance method import

Ruby on Rails 6.1.7.10

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

import(error, override_options = {})

Imports one error Imported errors are wrapped as a NestedError, providing access to original error object. If attribute or type needs to be overridden, use override_options.

override_options - Hash @option override_options [Symbol] :attribute Override the attribute the error belongs to @option override_options [Symbol] :type Override type of the error.

Parameters

error req
override_options opt = {}
Source
# File activemodel/lib/active_model/errors.rb, line 118
    def import(error, override_options = {})
      [:attribute, :type].each do |key|
        if override_options.key?(key)
          override_options[key] = override_options[key].to_sym
        end
      end
      @errors.append(NestedError.new(@base, error, override_options))
    end

Defined in activemodel/lib/active_model/errors.rb line 118 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveModel::Errors

Type at least 2 characters to search.

↑↓ navigate · open · esc close