Commit 308261afd069044dd7cf4345532e937746f8ec4d
1 parent
ce907252
Exists in
master
Fix update_all syntax in migration
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
db/migrate/20150930132305_move_points_category_to_categorization_tables.rb
... | ... | @@ -7,13 +7,13 @@ class MovePointsCategoryToCategorizationTables < ActiveRecord::Migration |
7 | 7 | settings = Noosfero::Plugin::Settings.new(env, GamificationPlugin) |
8 | 8 | weight = settings.settings.fetch(:point_rules, {}).fetch(name.to_s, {}).fetch('weight', setting[:default_weight]).to_i |
9 | 9 | cat = GamificationPlugin::PointsCategorization.create(point_type_id: type.id, weight: weight) |
10 | - Merit::Score.update_all "category = '#{cat.id}'", category: name | |
10 | + Merit::Score.where(category: name).update_all(category: cat.id.to_s) | |
11 | 11 | end |
12 | 12 | end |
13 | 13 | |
14 | 14 | def down |
15 | 15 | GamificationPlugin::PointsCategorization.all.each do |categorization| |
16 | - Merit::Score.update_all "category = '#{categorization.point_type.name}'", category: categorization.id.to_s | |
16 | + Merit::Score.where(category: categorization.id.to_s).update_all(category: categorization.point_type.name) | |
17 | 17 | categorization.point_type.destroy |
18 | 18 | categorization.destroy |
19 | 19 | end | ... | ... |