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# - SharpSVN - How to get the previous revision? -

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

url - Querystring manipulation of email Address in PHP -