My problem is that when I destroy some carrierwaved model:
Attachment.rb
mount_uploader :attachment, AttachmentUploader
I remove it from the database and serialize it to another table with revisions.
When the user reify the deleted attachment, I need to insert the row back but skipping specific carrierwave callbacks (skip the mount uploder I guess).
The code bellow can do that, but unfortunately it removes all the callbacks from the model and I need them. So I have to skip carrierwave uploader only, otherwise it throws exception with “invalid attachment” when create.
model.class.skip_callbacks do
model.save
end
It’s possible to do? Thanks!
You can skip specific callbacks using skip_callback, specified with a lambda. Combine that with the specific callback you are trying to avoid and you should be able to achieve the control you are looking for.