Commit 5df2220743210e51ed8bdfb551de80547e706531

Authored by Victor Costa
1 parent 1883263d

Fix migration for empty databases

db/migrate/20150930132305_move_points_category_to_categorization_tables.rb
... ... @@ -3,6 +3,7 @@ class MovePointsCategoryToCategorizationTables < ActiveRecord::Migration
3 3 Merit::PointRules::AVAILABLE_RULES.each do |name, setting|
4 4 type = GamificationPlugin::PointsType.create(name: name.to_s, description: setting[:description])
5 5 env = Environment.default
  6 + next if env.blank?
6 7 settings = Noosfero::Plugin::Settings.new(env, GamificationPlugin)
7 8 weight = settings.settings.fetch(:point_rules, {}).fetch(name.to_s, {}).fetch('weight', setting[:default_weight]).to_i
8 9 cat = GamificationPlugin::PointsCategorization.create(point_type_id: type.id, weight: weight)
... ...