I’m using CarrierWave in a Rails3 app to upload assets. All good on the upload side, but when the destroy method is invoked, the corresponding asset is not removed.
It looks like CarrierWave creates dynamic methods for this that one can use in the destroy method so if the model is avatar then methods like remove_avatar spring into existence.
However, I can’t get any of that to work. Any hints much appreciated.
I’m sorry to answer my own question, but in my case, it was a simple case of overlooking the obvious: The CarrierWave model needed a string field to contain the path name. So my model is:
and the correct migration was:
The missing part of the incantation was that the “asset” string was missing in my migration. I guess I was just not seeing the requirement in the documents although good sense would have made it immediately obvious.