Adds Ballot Sheet model and business logic
This commit is contained in:
@@ -19,13 +19,13 @@ class Officing::BallotSheetsController < Officing::BaseController
|
||||
|
||||
def create
|
||||
load_officer_assignment
|
||||
check_officer_assignment
|
||||
|
||||
@ballot_sheet = Poll::BallotSheet.new(ballot_sheet_params)
|
||||
|
||||
if @ballot_sheet.save
|
||||
redirect_to officing_poll_ballot_sheet_path(@poll, @ballot_sheet)
|
||||
else
|
||||
flash.now[:alert] = @ballot_sheet.errors.full_messages.join(", ")
|
||||
render :new
|
||||
end
|
||||
end
|
||||
@@ -63,13 +63,6 @@ class Officing::BallotSheetsController < Officing::BaseController
|
||||
.find_by(id: ballot_sheet_params[:officer_assignment_id])
|
||||
end
|
||||
|
||||
def check_officer_assignment
|
||||
if @officer_assignment.blank?
|
||||
flash.now[:alert] = t("officing.results.flash.error_wrong_booth")
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def ballot_sheet_params
|
||||
params.permit(:data, :poll_id, :officer_assignment_id)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user