Note we're excluding a few files: * Configuration files that weren't generated by us * Migration files that weren't generated by us * The Gemfile, since it includes an important comment that must be on the same line as the gem declaration * The Budget::Stats class, since the heading statistics are a mess and having shorter lines would require a lot of refactoring
30 lines
768 B
Ruby
30 lines
768 B
Ruby
class Officing::ResidenceController < Officing::BaseController
|
|
before_action :load_officer_assignment
|
|
before_action :verify_officer_assignment
|
|
before_action :verify_booth
|
|
|
|
def new
|
|
@residence = Officing::Residence.new
|
|
end
|
|
|
|
def create
|
|
@residence = Officing::Residence.new(residence_params.merge(officer: current_user.poll_officer))
|
|
if @residence.save
|
|
redirect_to new_officing_voter_path(id: @residence.user.id),
|
|
notice: t("officing.residence.flash.create")
|
|
else
|
|
render :new
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def residence_params
|
|
params.require(:residence).permit(allowed_params)
|
|
end
|
|
|
|
def allowed_params
|
|
[:document_number, :document_type, :year_of_birth, :date_of_birth, :postal_code]
|
|
end
|
|
end
|