You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
575 B
23 lines
575 B
3 years ago
|
class BulkUploadController < ApplicationController
|
||
|
def show
|
||
|
@bulk_upload = BulkUpload.new(nil, nil)
|
||
|
render "case_logs/bulk_upload"
|
||
|
end
|
||
|
|
||
|
def bulk_upload
|
||
|
file = upload_params.tempfile
|
||
|
content_type = upload_params.content_type
|
||
|
@bulk_upload = BulkUpload.new(file, content_type)
|
||
|
@bulk_upload.process
|
||
|
if @bulk_upload.errors.present?
|
||
|
render "case_logs/bulk_upload", status: :unprocessable_entity
|
||
|
else
|
||
|
redirect_to(case_logs_path)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def upload_params
|
||
|
params.require("bulk_upload")["case_log_bulk_upload"]
|
||
|
end
|
||
|
end
|