From 74c15a6a2ce81f829833f59b92f87ca34961dfd2 Mon Sep 17 00:00:00 2001 From: Hugo Melo Date: Wed, 14 Oct 2015 09:57:19 -0300 Subject: [PATCH] Avoid error on badge migration --- db/migrate/20151003000212_move_badge_threshold_to_action_key.rb | 1 + 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/db/migrate/20151003000212_move_badge_threshold_to_action_key.rb b/db/migrate/20151003000212_move_badge_threshold_to_action_key.rb index 24d3736..6942bd5 100644 --- a/db/migrate/20151003000212_move_badge_threshold_to_action_key.rb +++ b/db/migrate/20151003000212_move_badge_threshold_to_action_key.rb @@ -6,6 +6,7 @@ class MoveBadgeThresholdToActionKey < ActiveRecord::Migration GamificationPlugin::Badge.all.each do |badge| next if Merit::BadgeRules::AVAILABLE_RULES[badge.name.to_sym].nil? Merit::BadgeRules::AVAILABLE_RULES[badge.name.to_sym].each do |setting| + badge.custom_fields = {} unless badge.custom_fields.is_a? Hash badge.custom_fields[setting[:action]] = {threshold: badge.custom_fields[:threshold]} unless badge.custom_fields[:threshold].nil? badge.save end -- libgit2 0.21.2