From a088321498947cb0c0ffa852f4c7a29518b152b7 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 29 Mar 2018 03:07:13 +0200 Subject: [PATCH] Followup fix for issue #1752 - tree got lost after update. --- app/controllers/object_manager_attributes_controller.rb | 2 +- db/migrate/20180220171219_check_for_object_attributes.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/object_manager_attributes_controller.rb b/app/controllers/object_manager_attributes_controller.rb index a61e8516b..ab55ba001 100644 --- a/app/controllers/object_manager_attributes_controller.rb +++ b/app/controllers/object_manager_attributes_controller.rb @@ -127,7 +127,7 @@ class ObjectManagerAttributesController < ApplicationController permitted[:data_option][:null] = true end - if !permitted[:data_option][:options].is_a?(Hash) + if !permitted[:data_option][:options].is_a?(Hash) && !permitted[:data_option][:options].is_a?(Array) permitted[:data_option][:options] = {} end diff --git a/db/migrate/20180220171219_check_for_object_attributes.rb b/db/migrate/20180220171219_check_for_object_attributes.rb index ec2ebe05a..6b76a6a3d 100644 --- a/db/migrate/20180220171219_check_for_object_attributes.rb +++ b/db/migrate/20180220171219_check_for_object_attributes.rb @@ -21,12 +21,12 @@ class CheckForObjectAttributes < ActiveRecord::Migration[5.1] end def fix_nil_data_option(attribute) - return if attribute[:data_option].is_a?(Hash) + return if attribute[:data_option].is_a?(Hash) || attribute[:data_option][:options].is_a?(Array) attribute[:data_option] = {} end def fix_options(attribute) - return if attribute[:data_option][:options].is_a?(Hash) + return if attribute[:data_option][:options].is_a?(Hash) || attribute[:data_option][:options].is_a?(Array) attribute[:data_option][:options] = {} end