Module: Gitlab::Import::Errors
- Defined in:
- lib/gitlab/import/errors.rb
Class Method Summary collapse
-
.merge_nested_errors(object) ⇒ Object
Merges all nested subrelation errors into base errors object.
Class Method Details
.merge_nested_errors(object) ⇒ Object
Merges all nested subrelation errors into base errors object.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab/import/errors.rb', line 28 def self.merge_nested_errors(object) object.errors.each do |error| association = object.class.reflect_on_association(error.attribute) next unless association&.collection? records = object.public_send(error.attribute).select(&:invalid?) # rubocop: disable GitlabSecurity/PublicSend records.each do |record| merge_nested_errors(record) object.errors.merge!(record.errors) end end end |