New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot remove the last image file of a collection! #2141
Comments
I found the source of the issue, it remains at the /lib/carrierwave/orm/activerecord.rb#L66 if !(new_file.blank? && send(:#{column}).blank?) It refuses the blank file! I guess @eavgerinos didn't think the case that maybe someone wants to remove the images at #1571 when he commit the line! |
You can little bit modify solution from here and go with something like this:
I will remove your file if only one left in array. |
I find out there is another way to do it with just params rails provided.
In ImagesController.rb
|
Merging into #1990. |
I want to selectively remove the uploaded images as a solution provided by @bobintornado at #1704.
Everything works fine except that when I want to delete the last image in my collection It does not assign the
images
value to[]
the below is the debugging mode that I tested the procedure manually and deliberately assigned theimages
to[]
but the model persists in maintaining its previous value!!I guess you have to open the below image in new tab and zoom in to see details :D
The code is as following:
The database schema:
How to fix this?
The text was updated successfully, but these errors were encountered: