From aa346d0b6a348a9bacb20eadba99044e27a573e1 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Wed, 2 Oct 2024 17:05:16 -0400 Subject: [PATCH] use replace security question path for update (#2787) (#2791) Co-authored-by: Utkarsh Shukla --- .../users/security_question_responses/_edit_modal.html.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/users/security_question_responses/_edit_modal.html.erb b/app/views/users/security_question_responses/_edit_modal.html.erb index 48f7036cc81..37ea95879a0 100644 --- a/app/views/users/security_question_responses/_edit_modal.html.erb +++ b/app/views/users/security_question_responses/_edit_modal.html.erb @@ -4,7 +4,12 @@ - <%= form_for [:user, current_user.security_question_responses.build], url: main_app.user_security_question_responses_path(user_id: current_user.id.to_s), method: method, name: "user_security_question_responses[]", remote: true do |f| %> + <% if current_user.security_question_responses.present? %> + <% url = main_app.user_security_question_responses_replace_path(user_id: current_user.id.to_s)%> + <% else %> + <% url = main_app.user_security_question_responses_path(user_id: current_user.id.to_s)%> + <% end %> + <%= form_for [:user, current_user.security_question_responses.build], url: url, method: method, name: "user_security_question_responses[]", remote: true do |f| %>