igorkasyanchuk/active_storage_validations

Incorrect error message when validator is used with :if or :on

Mth0158 opened this issue · 1 comments

From #209

This PR fixes issues with randomly generated error codes when using extra options like :if, :on etc. Additionally, it adds a new extension to the size matcher that enables users to define custom validation context.

Error messages:
on

  • example:
    • Size with context translation missing: en.activerecord.errors.models.size/portfolio.attributes.size_with_context.file_size_not_on
  • expected:
    • Size with context file size must be less than 2 KB (current size is 10 KB)

if

  • example:
    • Size with if translation missing: en.activerecord.errors.models.size/portfolio.attributes.size_with_if.file_size_not_if
  • expected:
    • Size with if file size must be less than 2 KB (current size is 10 KB)

Fixed with Mth0158@16dc799