sydevs / Atlas

Central database of worldwide meditation classes
6 stars 5 forks source link

Switch from CarrierWave to Shrine.rb #20

Closed Ardnived closed 4 years ago

Ardnived commented 4 years ago

I initially implemented the image upload using Carrierwave. However, carrierwave doesn't have a proper integration for multiple uploads.

The current upload code will result in a race condition when you try to upload two files at once which results in only one of the files being saved to the database. (Because the whole images array is set whenever the database is modified instead of just appending to the image array).

One solution is to use Shrine which has an explicit integration with Uppy. The other option might be to only allow one image to be uploaded at a time, but that would be a big usability hit.