diff --git a/app/helpers/authorization_requests_helpers.rb b/app/helpers/authorization_requests_helpers.rb index 02ccd925b..48b5f4f6e 100644 --- a/app/helpers/authorization_requests_helpers.rb +++ b/app/helpers/authorization_requests_helpers.rb @@ -1,7 +1,12 @@ module AuthorizationRequestsHelpers + # rubocop:disable Rails/HelperInstanceVariable def new_authorization_request_hidden_params - params.slice(:attributes).permit! + return {} if @authorization_request.persisted? + + permitted_params = params.slice(:attributes).permit! + permitted_params[:attributes] end + # rubocop:enable Rails/HelperInstanceVariable def start_authorization_request_form(form, disabled: false) text = t('start_authorization_request_form.cta', authorization_name: form.authorization_definition.name) diff --git a/app/views/authorization_request_forms/_form.html.erb b/app/views/authorization_request_forms/_form.html.erb index f5bb35966..7763c11ea 100644 --- a/app/views/authorization_request_forms/_form.html.erb +++ b/app/views/authorization_request_forms/_form.html.erb @@ -18,7 +18,7 @@ <%= yield %> - <%= render partial: "authorization_request_forms/shared/hidden_params", locals: { f: f } unless @authorization_request.persisted? %> + <%= render partial: "authorization_request_forms/shared/hidden_params", locals: { f: f } %> <% if content_for? :sticky_bar %> diff --git a/app/views/authorization_request_forms/shared/_hidden_params.html.erb b/app/views/authorization_request_forms/shared/_hidden_params.html.erb index 72ba58550..70fac6375 100644 --- a/app/views/authorization_request_forms/shared/_hidden_params.html.erb +++ b/app/views/authorization_request_forms/shared/_hidden_params.html.erb @@ -1,5 +1,3 @@ -<% if new_authorization_request_hidden_params.present? && new_authorization_request_hidden_params[:attributes].present? %> - <% new_authorization_request_hidden_params[:attributes].each do |key, value| %> - <%= f.hidden_field key, value: %> - <% end %> -<% end %> \ No newline at end of file +<% new_authorization_request_hidden_params[:attributes].each do |key, value| %> + <%= f.hidden_field key, value: %> +<% end %>