Skip to content

Commit 1c26a39

Browse files
committed
Fix test
It seems now attribute being base should always be part of the key
1 parent 0a36c36 commit 1c26a39

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

activerecord/lib/active_record/associations/nested_error.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ def initialize(association, inner_error)
1818
def compute_attribute(inner_error)
1919
association_name = association.reflection.name
2020

21-
attribute =
22-
if index_errors_setting && index
23-
"#{association_name}[#{index}]"
24-
else
25-
association_name
26-
end
27-
28-
attribute = :"#{attribute}.#{inner_error.attribute}" if inner_error.attribute != :base
29-
attribute.to_sym
21+
if index_errors_setting && index
22+
"#{association_name}[#{index}].#{inner_error.attribute}".to_sym
23+
else
24+
"#{association_name}.#{inner_error.attribute}".to_sym
25+
end
3026
end
3127

3228
def index_errors_setting

0 commit comments

Comments
 (0)