在上传后,destroy删除的是数据库的路径,需要使用File.delete删除路径下的文件
p_w_picpath_url = self.p_w_picpath_url path = "#{Rails.root}/app/assets/p_w_picpaths/" + p_w_picpath_url if File.exists?(path) File.delete(path) end
本文共 313 字,大约阅读时间需要 1 分钟。
在上传后,destroy删除的是数据库的路径,需要使用File.delete删除路径下的文件
p_w_picpath_url = self.p_w_picpath_url path = "#{Rails.root}/app/assets/p_w_picpaths/" + p_w_picpath_url if File.exists?(path) File.delete(path) end
转载于:https://blog.51cto.com/qihoushangshu/1550016