Skip to content

Commit 99f4279

Browse files
committed
[Rails] Handles properly nested error for Rails >= 8.0.2
1 parent 58a76f8 commit 99f4279

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- 2.0.4
2+
- Fix issue when updating a child record through a parent (like: parent_model.update(child_attributes: { image: file })) for Rails >= 8.0.2 (https://github.com/igorkasyanchuk/active_storage_validations/pull/378)
3+
14
- 2.0.3
25
- Allow to pass an Array, a splatted Array, or a single string for allowing / rejecting content_type matcher methods (https://github.com/igorkasyanchuk/active_storage_validations/pull/372)
36
- Fix issue when an attachment was missing on a blob (https://github.com/igorkasyanchuk/active_storage_validations/pull/373)

lib/active_storage_validations/shared/asv_errorable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def add_error(record, attribute, error_type, **errors_options)
2222

2323
error = record.errors.add(attribute, error_type, **errors_options)
2424

25-
# Rails 8.1 introduced a new way to mark errors as nested
25+
# Rails 8.0.2 introduced a new way to mark errors as nested
2626
# https://github.com/igorkasyanchuk/active_storage_validations/issues/377
27-
if Rails.gem_version >= Gem::Version.new("8.1.0.alpha")
27+
if Rails.gem_version >= Gem::Version.new("8.0.2")
2828
# Mark errors as nested when they occur in a parent/child context
2929
set_nested_error(record, error) if updating_through_parent?(record)
3030
end

0 commit comments

Comments
 (0)