From 308261afd069044dd7cf4345532e937746f8ec4d Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Fri, 22 Apr 2016 14:25:42 -0300 Subject: [PATCH] Fix update_all syntax in migration --- db/migrate/20150930132305_move_points_category_to_categorization_tables.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20150930132305_move_points_category_to_categorization_tables.rb b/db/migrate/20150930132305_move_points_category_to_categorization_tables.rb index ab642c4..67994b9 100644 --- a/db/migrate/20150930132305_move_points_category_to_categorization_tables.rb +++ b/db/migrate/20150930132305_move_points_category_to_categorization_tables.rb @@ -7,13 +7,13 @@ class MovePointsCategoryToCategorizationTables < ActiveRecord::Migration settings = Noosfero::Plugin::Settings.new(env, GamificationPlugin) weight = settings.settings.fetch(:point_rules, {}).fetch(name.to_s, {}).fetch('weight', setting[:default_weight]).to_i cat = GamificationPlugin::PointsCategorization.create(point_type_id: type.id, weight: weight) - Merit::Score.update_all "category = '#{cat.id}'", category: name + Merit::Score.where(category: name).update_all(category: cat.id.to_s) end end def down GamificationPlugin::PointsCategorization.all.each do |categorization| - Merit::Score.update_all "category = '#{categorization.point_type.name}'", category: categorization.id.to_s + Merit::Score.where(category: categorization.id.to_s).update_all(category: categorization.point_type.name) categorization.point_type.destroy categorization.destroy end -- libgit2 0.21.2