Question

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. Is there any way to prevent that and restore the instance of the model using paper_trail ?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top