1
0
Fork 0

hack in only allowing bulk uploads of max 10

This commit is contained in:
Andrew Tomaka 2015-10-16 16:11:48 -04:00
parent 9e68871ef6
commit daceb1d21c

View file

@ -8,11 +8,19 @@ class Admin::EvidencesController < Admin::BaseController
end
def create
params[:evidence][:screenshot].each do |screenshot|
Evidence.new(screenshot: screenshot).save
end
evidence = params[:evidence][:screenshot]
redirect_to admin_evidences_path, notice: 'Evidence was created'
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