Skip to content

Commit f94dd5c

Browse files
committed
Fix represneted attribtues' errors moving
1 parent 3579daa commit f94dd5c

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

lib/active_data/model/representation.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,8 @@ def emerge_represented_attributes_errors!
7474

7575
if ActiveModel.version >= Gem::Version.new('6.1.0')
7676
def move_errors(from, to)
77-
errors.each do |error|
78-
next unless error.attribute == from
79-
80-
errors.add(to, error.type, message: error.message)
81-
errors.delete(error.attribute, error.type)
82-
end
77+
errors.where(from).each { |error| errors.add(to, error.type, message: error.message) }
78+
errors.delete(from)
8379
end
8480
else # up to 6.0.x
8581
def move_errors(from, to)

0 commit comments

Comments
 (0)