igorkasyanchuk/active_storage_validations

if and unless conditions broken on 1.0.0

daan-b opened this issue · 3 comments

Since release 1.0.0 we aren't allowed to use the if: and unless: statements on the validations:

validates :avatar, attached: true, content_type: 'image/png', dimension: { width: 200, height: 200 }, if: -> { avatar.attached? }

Will give an error:

 1.1) Failure/Error: if: -> { image.attached? }
          
          ArgumentError:
            wrong number of arguments (given 1, expected 0)

Probably because the new OptionProcUnfolding tries to parse the if and unless statements.

Fix is for now to downrgrade to 0.9.8

You are indeed right, it is fixed in #167, merged, but not yet released. @igorkasyanchuk could you maybe release a 1.0.1 with the fix (or even 1.1.0 if new functionality are in the main branch as well already)?

Thanks!

released! v1.0.1
thanks for your support