Quantcast
Channel: How to make carrierwave delete the file when destroying a record? - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by orion for How to make carrierwave delete the file when destroying a...

If one wants to delete a file but does not want to specify the full filename you can use the below. Can also be used to delete many files or all files in a directory with a specific extension...file =...

View Article



Answer by oconn for How to make carrierwave delete the file when destroying a...

Like @mu_is_too_short said, you can use File#delete. Here's a code snippet you could use as a helper with a little tweaking in your rails app.def remove_file(file) File.delete(file)endor if you just...

View Article

Answer by basicxman for How to make carrierwave delete the file when...

Not sure what CarrierWave offers for this, but you could use FileUtils in the Ruby standard library with an ActiveRecord callback.For instance,require 'FileUtils'before_destroy :remove_hard_imagedef...

View Article

How to make carrierwave delete the file when destroying a record?

I'm using the carrierwave gem to upload files.I have built a system for users to flag images as inappropriate and for admins to remove the images. From what I can tell, calling destroy on the image...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>