后台管理页面的数据问题及500修改

This commit is contained in:
sylor_huang@126.com 2020-05-25 10:23:33 +08:00
parent 7ca8dcbebd
commit 6646ee02fc
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
class AddIndexForProjectLanguageAndCategory < ActiveRecord::Migration[5.2]
def change
add_index :project_categories, :id unless index_exists?(:project_categories, :id)
add_index :project_laguages, :id unless index_exists?(:project_laguages, :id)
project_categories = ProejctCategory.includes(:projects)
project_categories.each do |i|
puts "#######____update_project_category_id____##############{i.id}"
ProejctCategory.reset_counters(i, :projects)
end
project_languages = ProjectLanguage.includes(:projects)
project_languages.each do |i|
puts "#######____update_project_language_id____##############{i.id}"
ProjectLanguage.reset_counters(i, :projects)
end
end
end