Ruby on rails 3 如何删除装载上载程序手动创建的目录

Ruby on rails 3 如何删除装载上载程序手动创建的目录,ruby-on-rails-3,carrierwave,Ruby On Rails 3,Carrierwave,我想删除由装载上载程序手动创建的目录。我有ArtistProduct和ArtistImage模型。我想通过artist product controller删除存储在文件中的图像。我试过: @art_images=ArtistImage.where("product_id=?",params[:id]) @art_images.each do |img| img.remove_image! end @art_images.delete_all 但图像并没有被删除。请帮我试试这个,它会从你

我想删除由装载上载程序手动创建的目录。我有ArtistProduct和ArtistImage模型。我想通过artist product controller删除存储在文件中的图像。我试过:

@art_images=ArtistImage.where("product_id=?",params[:id])
@art_images.each do |img|
img.remove_image!
 end
 @art_images.delete_all 

但图像并没有被删除。请帮我试试这个,它会从你的文件系统中删除目录

FileUtils.remove_dir("path to directory(which is to be deleted)/directoryname(to be deleted)", :force => true)