From 34c5c550fa5e537b2f24306cb0627d3d11628a83 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=8F=AD=E7=9A=84position=E8=BF=81?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20200114071917_migrate_coure_group_position.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20200114071917_migrate_coure_group_position.rb b/db/migrate/20200114071917_migrate_coure_group_position.rb index 0061eaad3..fc04e1bcb 100644 --- a/db/migrate/20200114071917_migrate_coure_group_position.rb +++ b/db/migrate/20200114071917_migrate_coure_group_position.rb @@ -6,7 +6,7 @@ class MigrateCoureGroupPosition < ActiveRecord::Migration[5.2] courses = Course.where(id: course_ids) courses.each do |course| - CourseGroup.where(coures_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index| + CourseGroup.where(course_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index| group.update!(position: index+1) end end