Start CSV importer feature
All checks were successful
CI / scan_ruby (push) Successful in 20s
CI / scan_js (push) Successful in 12s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 32s

This commit is contained in:
sto
2025-05-17 12:03:10 +02:00
parent 5ec0e264ba
commit 939e2157ab
14 changed files with 153 additions and 1 deletions

View File

@@ -42,6 +42,21 @@ class ContestantsController < ApplicationController
redirect_to contest_path(@contest)
end
def import
authorize @contest
if params[:csv_import]
@csv_import = CsvImport.new(params.require(:csv_import).permit(:file, :separator))
if @csv_import.save
@csv_import = CsvImport.new
else
render :import, status: :unprocessable_entity
end
else
@csv_import = CsvImport.new
end
end
private
def set_contest