I have two Mongoid models, Store and Product. Their relationship is that a Store has_many Products, and Products belongs_to Store. Each of these models has some images that can be attached using Carrierwave, that look like this:
mount_uploader :logo, ImageUploader
I am able to add and edit images that are in the Store model. But in Product I can only add an image on creation off a Product, but not with editing a product. This seems somehow to be a deep_copy issue, similar to how in Mongoid if you have an array called urls and you want to update that array, you must call
urls_will_change!
So I have tried calling the equivalent method (logo_will_change!) inside of a before_update callback, but it doesn’t do anything. Is there somewhere else I should be doing this or is it another problem?
The code below worked for me, so there may be something else going on: