Employer form mostly working with persist to db
This commit is contained in:
@@ -6,12 +6,16 @@ class EmployerSetupForm
|
||||
|
||||
attribute :current_step, :string, default: FIRST_STEP
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :employer_setup_process_id, :integer
|
||||
|
||||
def initialize(params = {})
|
||||
# if params.present?
|
||||
# params = permitted_params(params)
|
||||
# end
|
||||
# @current_step = params["current_step"]
|
||||
# @employer_setup_process_id = params["employer_setup_process_id"]
|
||||
super(params)
|
||||
|
||||
unless self.steps.first == FIRST_STEP
|
||||
raise StepMisalignmentError, "FIRST_STEP does not match first entry in steps"
|
||||
end
|
||||
@@ -53,7 +57,7 @@ class EmployerSetupForm
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:employer_setup_data).permit(
|
||||
params.permit(
|
||||
:pl_plan_key,
|
||||
:current_step
|
||||
)
|
||||
@@ -66,15 +70,16 @@ class EmployerSetupForm
|
||||
]
|
||||
end
|
||||
|
||||
# def save
|
||||
# if valid?
|
||||
# EmployerSetupGeneralInformationForm.new(attributes[:general_information_data]).save
|
||||
# EmployerSetupPlansForm.new(attributes[:plans_data]).save
|
||||
# EmployerSetupNetworkExceptionsForm.new(attributes[:network_exceptions_data]).save
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
def save
|
||||
if valid?
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
process.update(
|
||||
status: "entered"
|
||||
)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user