Skip to content

Commit

Permalink
Fix represneted attribtues' errors moving
Browse files Browse the repository at this point in the history
  • Loading branch information
shurikp committed Aug 26, 2022
1 parent 3579daa commit f038bf8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/active_data/model/representation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ def emerge_represented_attributes_errors!

if ActiveModel.version >= Gem::Version.new('6.1.0')
def move_errors(from, to)
errors.each do |error|
next unless error.attribute == from

errors.add(to, error.type, message: error.message)
errors.delete(error.attribute, error.type)
end
errors.where(from).each { |error| errors.add(to, error.type, **error.options) }
errors.delete(from)
end
else # up to 6.0.x
def move_errors(from, to)
Expand Down

0 comments on commit f038bf8

Please sign in to comment.