Deleting files in ruby -


i'm using carrierwave gem upload files. have built system users flag images inappropriate , admins remove images. can tell, calling destroy on image remove path name tabel. there way have ruby remove file itself? or should rails automatically removing file when destroy image path?

not sure carrierwave offers this, use fileutils in ruby standard library activerecord callback.

for instance,

require 'fileutils' before_destroy :remove_hard_image  def remove_hard_image   fileutils.rm(path_to_image) end 

sidenote: code memory.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -