解决公共资源删除资源后统计数字不减少的问题

(增加删除回调)
This commit is contained in:
huang 2016-03-16 13:48:02 +08:00
parent 9aab10c05a
commit 064dc81ed6
1 changed files with 2 additions and 2 deletions

View File

@ -1614,10 +1614,10 @@ class UsersController < ApplicationController
# 删除用户资源,分为批量删除 和 单个删除,只能删除自己上传的资源
def user_resource_delete
if params[:resource_id].present?
Attachment.where("author_id = #{User.current.id}").delete(params[:resource_id])
Attachment.where("author_id =? and id =?", User.current.id, params[:resource_id]).first.destroy
elsif params[:checkbox1].present?
params[:checkbox1].each do |id|
Attachment.where("author_id = #{User.current.id}").delete(id)
Attachment.where("author_id =? and id =?", User.current.id, id).first.destroy
end
end
@user = User.current