From 51d057ff9fcce75a587cd4c8fa64a33c3eadddbd Mon Sep 17 00:00:00 2001 From: vishal kalletla Date: Thu, 12 Dec 2024 13:08:45 -0500 Subject: [PATCH] do not store as hash data for a string value (#4822) * do not store as hash data for a string value * allow admin to add/edit reason when the broker application status is pending * add spec * rubocop fix --- .../exchanges/broker_applicants_controller.rb | 2 +- .../shared/brokers/_broker_fields.html.erb | 4 +- .../broker_applicants_controller_spec.rb | 71 +++++++++++++------ 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/app/controllers/exchanges/broker_applicants_controller.rb b/app/controllers/exchanges/broker_applicants_controller.rb index ecfda628f54..50df9bdfc52 100644 --- a/app/controllers/exchanges/broker_applicants_controller.rb +++ b/app/controllers/exchanges/broker_applicants_controller.rb @@ -38,7 +38,7 @@ def edit def update broker_role = @broker_applicant.broker_role - broker_role.update_attributes(reason: params.require(:person).require(:broker_role_attributes).permit(:reason)) if params.dig(:person, :broker_role_attributes, :reason).present? + broker_role.update_attributes(reason: params.require(:person).require(:broker_role_attributes).permit(:reason)[:reason]) if params.dig(:person, :broker_role_attributes, :reason).present? # TODO: This params['deny'] stuff might have to be changed to params['commit']['action_name'] if params['deny'] broker_role.deny! diff --git a/app/views/shared/brokers/_broker_fields.html.erb b/app/views/shared/brokers/_broker_fields.html.erb index a306e3d9e8a..354f0685d66 100644 --- a/app/views/shared/brokers/_broker_fields.html.erb +++ b/app/views/shared/brokers/_broker_fields.html.erb @@ -39,7 +39,7 @@
<%= f.fields_for :broker_role do |broker_role_fields| %> - <% disabled = (broker_or_staff_role.active? || broker_or_staff_role.agency_pending?) ? true : false %> + <% disabled = broker_or_staff_role.active? ? true : false %>