Skip to content

Commit b971bc5

Browse files
authored
fix rails 6.1 deprecation warning: errors.each no longer hash-style (#99)
* fix rails 6.1 deprecation warning: errors.each no longer hash-style * actually fix rails 6.1 deprecation warning: errors.each no longer hash-style
1 parent 26d66cb commit b971bc5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/csv_importer/row.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ def set_attribute(model, column, csv_value)
7777
# Error from the model mapped back to the CSV header if we can
7878
def errors
7979
Hash[
80-
model.errors.map do |attribute, errors|
80+
model.errors.to_hash.map do |attribute, errors|
8181
if column_name = header.column_name_for_model_attribute(attribute)
82-
[column_name, errors]
82+
[column_name, errors.last]
8383
else
84-
[attribute, errors]
84+
[attribute, errors.last]
8585
end
8686
end
8787
]

0 commit comments

Comments
 (0)