|
|
|
@ -12,7 +12,7 @@ class TaskBanksController < ApplicationController
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
@bank.update_attributes(gtask_bank_params)
|
|
|
|
|
Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids]
|
|
|
|
|
Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids].blank?
|
|
|
|
|
normal_status(0, "更新成功")
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger(e.message)
|
|
|
|
@ -42,7 +42,10 @@ class TaskBanksController < ApplicationController
|
|
|
|
|
tip_exception("最小人数不能小于1") if params[:gtask_bank][:min_num].to_i < 1
|
|
|
|
|
tip_exception("最大人数不能小于最小人数") if params[:gtask_bank][:max_num].to_i < params[:gtask_bank][:min_num].to_i
|
|
|
|
|
end
|
|
|
|
|
params.require(:gtask_bank).permit(:name, :description) if @bank.task_type == 1
|
|
|
|
|
params.require(:gtask_bank).permit(:name, :description, :min_num, :max_num, :base_on_project) if @bank.task_type == 2
|
|
|
|
|
if @bank.task_type == 1
|
|
|
|
|
params.require(:gtask_bank).permit(:name, :description)
|
|
|
|
|
else
|
|
|
|
|
params.require(:gtask_bank).permit(:name, :description, :min_num, :max_num, :base_on_project)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|