From ce9d8ee40061e1c0f91b72f71330aea163065bb8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 17 Jan 2020 18:11:32 +0800 Subject: [PATCH] 1 --- .../20200117095750_modify_1_wechat_support_for_shixuns.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20200117095750_modify_1_wechat_support_for_shixuns.rb b/db/migrate/20200117095750_modify_1_wechat_support_for_shixuns.rb index 3e099e9ac..1e973b014 100644 --- a/db/migrate/20200117095750_modify_1_wechat_support_for_shixuns.rb +++ b/db/migrate/20200117095750_modify_1_wechat_support_for_shixuns.rb @@ -1,9 +1,9 @@ class Modify1WechatSupportForShixuns < ActiveRecord::Migration[5.2] def change - shixuns = Shixun.joins(:challenges).where(is_wechat_support: true) + shixuns = Shixun.joins(:challenges).where(is_wechat_support: true, status: 2) .select("shixuns.*, challenges.path path") shixuns.each do |shixun| - if shixun.path.split(";").count > 1 + if shixun.path && shixun.path.split(";").count > 1 shixun.update_attribute(:is_wechat_support, false) end end