diff --git a/app/controllers/infra_networking_controller.rb b/app/controllers/infra_networking_controller.rb index 70d54b7e04f..821b0af841e 100644 --- a/app/controllers/infra_networking_controller.rb +++ b/app/controllers/infra_networking_controller.rb @@ -380,7 +380,7 @@ def replace_right_cell(options = {}) partial_locals = {:controller =>'infra_networking'} if partial == 'layouts/x_gtl' partial_locals[:action_url] = @lastaction - presenter[:parent_id] = @record.id.to_s # Set parent rec id for JS function miqGridSort to build URL + presenter[:parent_id] = @record.id # Set parent rec id for JS function miqGridSort to build URL presenter[:parent_class] = params[:controller] # Set parent class for URL also end presenter.update(:main_div, r[:partial => partial, :locals => partial_locals]) diff --git a/app/controllers/vm_common.rb b/app/controllers/vm_common.rb index a402bb6dfa3..8b8f86bb7b7 100644 --- a/app/controllers/vm_common.rb +++ b/app/controllers/vm_common.rb @@ -1261,7 +1261,7 @@ def replace_right_cell(options = {}) partial_locals[:action_url] = @lastaction # Set parent record id & class for JS function miqGridSort to build URL - presenter[:parent_id] = @record.id.to_s + presenter[:parent_id] = @record.id presenter[:parent_class] = params[:controller] end presenter.update(:main_div, r[:partial => partial, :locals => partial_locals]) diff --git a/app/helpers/miq_ae_customization_helper.rb b/app/helpers/miq_ae_customization_helper.rb index 4d655d89b95..f3d1a7aceab 100644 --- a/app/helpers/miq_ae_customization_helper.rb +++ b/app/helpers/miq_ae_customization_helper.rb @@ -2,7 +2,7 @@ module MiqAeCustomizationHelper def dialog_id_action url = request.parameters if url[:id].present? - {:id => @record.id, :action => 'edit'} + {:id => @record.id.to_s, :action => 'edit'} elsif url[:copy].present? {:id => url[:copy], :action => 'copy'} else diff --git a/app/presenters/explorer_presenter.rb b/app/presenters/explorer_presenter.rb index 15d6d40e0ad..a753667ea11 100644 --- a/app/presenters/explorer_presenter.rb +++ b/app/presenters/explorer_presenter.rb @@ -292,10 +292,11 @@ def for_render_default toolbar end + # ids are nil or string data[:record] = { - :parentId => @options[:parent_id], + :parentId => @options[:parent_id]&.to_s, :parentClass => @options[:parent_class], - :recordId => @options[:record_id], + :recordId => @options[:record_id]&.to_s, } unless @options[:osf_node].blank? diff --git a/spec/presenters/explorer_presenter_spec.rb b/spec/presenters/explorer_presenter_spec.rb index f23f48a71e6..587b75772fc 100644 --- a/spec/presenters/explorer_presenter_spec.rb +++ b/spec/presenters/explorer_presenter_spec.rb @@ -25,9 +25,9 @@ end context "#[:record_id]" do - it 'sets :record object' do + it 'sets :record object, ensuring string id' do @presenter[:record_id] = 666 - expect(subject[:record][:recordId]).to eq(666) + expect(subject[:record][:recordId]).to eq("666") end end