Files
nairobi/app/controllers/officing/residence_controller.rb
taitus 3e383d7c1f Add new fields to form
- Add :date_of_birth and :postal_code
- Only display new fields when aplication has configured the
custom census API and contains alias values for fields. Add 2
class Setting methods to check this feature:
  - force_presence_date_of_birth?
  - force_presence_postal_code?
2019-07-29 13:10:09 +02:00

28 lines
737 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(:document_number, :document_type, :year_of_birth,
:date_of_birth, :postal_code)
end
end