How to use paper_trail with carrierwave (for undo support)?
I'm trying to include undo support using the paper_trail
gem and the tutorial described in this railscast http://railscasts.com/episodes/255-undo-with-paper-trail.
The thing is that my model also uses carrierwave
for pictures manipulation. After deleting an instance of the model, the picture also gets deleted.开发者_如何学Python Is there any way to prevent that and restore the instance of the model using paper_trail
?
Don't delete the file, just delete the reference to it (database entry). Or, if you need the space, mark it for deletion and have a cron job run to delete the file at a later time.
You could also put the file in the database, but because of the way paper trail versions, this has the potential for taking up significantly more space.
精彩评论