ministryofjustice/atet

View on GitHub
app/controllers/multiple_respondents_controller.rb

Summary

Maintainability
A
30 mins
Test Coverage
class MultipleRespondentsController < ClaimsController
def show
resource.secondary_respondents.build if resource.secondary_respondents.empty?
end
 
Similar blocks of code found in 2 locations. Consider refactoring.
def update
resource.assign_attributes params[current_step].permit!
 
if params[:commit] == "claims.#{current_step}.add_fields"
resource.secondary_respondents.build
 
render :show
elsif resource.save
redirect_to next_page
else
render action: :show
end
end
end