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