diff --git a/app/controllers/concerns/steps_actions.rb b/app/controllers/concerns/steps_actions.rb index 2676a2202..5f25c8709 100644 --- a/app/controllers/concerns/steps_actions.rb +++ b/app/controllers/concerns/steps_actions.rb @@ -18,7 +18,7 @@ module StepsActions new_checklists = step_params[:checklists_attributes] if new_checklists - new_checklists.each do |e| + new_checklists.to_h.each do |e| list = PreviousChecklist.new( e.second[:id].to_i, e.second[:name] diff --git a/app/controllers/steps_controller.rb b/app/controllers/steps_controller.rb index a6b65fb06..d80f8ab44 100644 --- a/app/controllers/steps_controller.rb +++ b/app/controllers/steps_controller.rb @@ -547,9 +547,9 @@ class StepsController < ApplicationController # Delete the step table def delete_step_tables(params) return unless params[:tables_attributes].present? - params[:tables_attributes].each do |table| - next unless table.second['_destroy'] - table_to_destroy = Table.find_by(id: table.second['id']) + params[:tables_attributes].each do |_, table| + next unless table['_destroy'] + table_to_destroy = Table.find_by_id(table['id']) table_to_destroy.report_elements.destroy_all end end