hack in only allowing bulk uploads of max 10
This commit is contained in:
parent
9e68871ef6
commit
daceb1d21c
1 changed files with 12 additions and 4 deletions
|
@ -8,12 +8,20 @@ class Admin::EvidencesController < Admin::BaseController
|
|||
end
|
||||
|
||||
def create
|
||||
params[:evidence][:screenshot].each do |screenshot|
|
||||
evidence = params[:evidence][:screenshot]
|
||||
|
||||
if evidence.size > 10
|
||||
@evidence = Evidence.new
|
||||
flash.now[:notice] = 'Only 10 evidence can be submitted at once'
|
||||
render :new
|
||||
else
|
||||
evidence.each do |screenshot|
|
||||
Evidence.new(screenshot: screenshot).save
|
||||
end
|
||||
|
||||
redirect_to admin_evidences_path, notice: 'Evidence was created'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@evidence = Evidence.find(params[:id])
|
||||
|
|
Loading…
Reference in a new issue