I am using the carrier wave gem for file uploading, and I am not able to
delete the original file after uploading. I tried the below code but it
didn’t work, any help would be really appreciated.
after :store, :unlink_original
def unlink_original(file)
File.delete(store_dir+’/’[email protected]_file) #path of the original file
end*
File.delete(store_dir+'/'[email protected]_file) #path of the original file
end
Have you confirmed that unlink_original is being called and that the
correct file name is being built and passed to delete? If you have
not already done so then I suggest logging a message showing the value
os
store_dir+’/’[email protected]_file and makes sure that it appears ok.
Alternatively break in with the debugger to make sure it is ok.
Colin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.