Improved error handling. Also let migration working if already valid records are already in database (then skip this records).

This commit is contained in:
Martin Edenhofer 2017-09-08 17:39:57 +02:00
parent b96c57210a
commit 553dcef3db

View file

@ -33,6 +33,7 @@ class CtiLogPreferencesMigration < ActiveRecord::Migration[5.0]
# loop over all instances and covert them
# to an Hash via .attributes
updated = item.preferences[direction].each_with_object([]) do |caller_id, new_direction|
next if !caller_id.respond_to?(:attributes)
new_direction.push(caller_id.attributes)
end