You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
431 B
16 lines
431 B
class MigrateDisciplinePosition < ActiveRecord::Migration[5.2]
|
|
def change
|
|
Discipline.all.each_with_index do |discipline, i|
|
|
discipline.update_column("position", i + 1)
|
|
|
|
discipline.sub_disciplines.each_with_index do |sub, j|
|
|
sub.update_column("position", j + 1)
|
|
|
|
sub.tag_disciplines.each_with_index do |tag, k|
|
|
tag.update_column("position", k + 1)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|