You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change 1531a67 led to a breaking change with enable_processing configuration.
Before this change we could change versions' enable_processing by calling the mounted column uploader's config like in the README.
MyUploader.enable_processing=true
Although, 3.0.0 has a complex change with this behavior. The above configuration sometimes works, but sometimes not.
Minimum reproducible example
classTestImageUploader < CarrierWave::Uploader::Baseversion:testdoendendclassTestImage < ActiveRecord::Basemount_uploader:image,TestImageUploaderendi=TestImage.newi.image.class.instance_variablesi.image.enable_processingi.image.class.instance_variables# instance_variable `@enable_processing` is seti.image.test.class.instance_variablesi.image.test.enable_processingi.image.test.class.instance_variables# instance_variable `@enable_processing` is not set before 3.0.0 but set in 3.0.0
Problem
We noticed this change with our test suite.
If we have called the mounted column somewhere in our test, we cannot change the enable_processing configuration of the versions afterwards in other tests.
RSpec.describeTestImageUploaderdodescribe'test1'dolet(:test_image){build(:test_image)}it'run something that invokes enable_processing'dotest_image.image=File.open('foo.jpg','rb')endenddescribe'test2'dolet(:test_image){build(:test_image)}beforedoTestImageUploader.enable_processing=trueendafterdoTestImageUploader.enable_processing=falseendit'can change enable_processing'doexpect(test_image.image.test.enable_processing).tobetrueendendend
test2 succeeds if you run it individually, but fails if you run after test1.
I don't have a valid use-case in production, but if someone is changing enable_processing dynamically in their application, the same issue might happen.
My intention was that the inheritance structure change in 1531a67 will make the #enable_processing patch unnecessary, but actually it wasn't as you mentioned. I've restored the #enable_processing patch back and now this is fixed.
Summary
This change 1531a67 led to a breaking change with enable_processing configuration.
Before this change we could change versions'
enable_processing
by calling the mounted column uploader's config like in the README.Although, 3.0.0 has a complex change with this behavior. The above configuration sometimes works, but sometimes not.
Minimum reproducible example
Problem
We noticed this change with our test suite.
If we have called the mounted column somewhere in our test, we cannot change the
enable_processing
configuration of the versions afterwards in other tests.test2 succeeds if you run it individually, but fails if you run after test1.
I don't have a valid use-case in production, but if someone is changing
enable_processing
dynamically in their application, the same issue might happen.I believe restoring these lines
1531a67#diff-c3e7243412c35dfefcaf2569736474b74402cc34cb550e472aacef867d91da18L90-L97
in the
Builder
can fix this issue, but want some opinions before proceeding.The text was updated successfully, but these errors were encountered: