igorkasyanchuk / active_storage_validations

Do it like => validates :photos, attached: true, content_type: ['image/png', 'image/jpg', 'image/jpeg'], size: { less_than: 500.kilobytes }, limit: { min: 1, max: 3 }, aspect_ratio: :landscape, dimension: { width: { in: 800..1600 }
https://www.railsjazz.com/
MIT License
1.02k stars 130 forks source link

Adapt code to remove warning for Rails 7.1 #222

Closed Mth0158 closed 10 months ago

Mth0158 commented 11 months ago

When running tests with Rails 7, we have the below warning message:

DEPRECATION WARNING: config.active_storage.replace_on_assign_to_many is deprecated and will be removed in Rails 7.1. Make sure that your code works well with config.active_storage.replace_on_assign_to_many set to true before upgrading. To append new attachables to the Active Storage association, prefer using attach. Using association setter would result in purging the existing attached attachments and replacing them with new ones. (called from block in at /Users/mathieueustachy/code/maycowmeira/active_storage_validations/test/active_storage_validations_test.rb:470)

It could be interesting to adapt our code for Rails 7 in order to be compatible in 7.1 so that users do not experience interruption of service with our gem

Mth0158 commented 10 months ago

After investigation, this warning is not directly related to the gem, it's up to the Rails users to update their config.active_storage.replace_on_assign_to_many config, so I am closing this issue.