Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
It seems now attribute being base should always be part of the key
  • Loading branch information
lulalala committed May 9, 2024
1 parent 0a36c36 commit 1c26a39
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions activerecord/lib/active_record/associations/nested_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ def initialize(association, inner_error)
def compute_attribute(inner_error)
association_name = association.reflection.name

attribute =
if index_errors_setting && index
"#{association_name}[#{index}]"
else
association_name
end

attribute = :"#{attribute}.#{inner_error.attribute}" if inner_error.attribute != :base
attribute.to_sym
if index_errors_setting && index
"#{association_name}[#{index}].#{inner_error.attribute}".to_sym
else
"#{association_name}.#{inner_error.attribute}".to_sym
end
end

def index_errors_setting
Expand Down

0 comments on commit 1c26a39

Please sign in to comment.