迁移及勾选问题

sso
jingquan huang 5 years ago
parent 8f6539373e
commit 208ac3cac3

@ -8,12 +8,6 @@ class Admins::SubjectSettingsController < Admins::BaseController
end end
def update def update
# 为了复用代码
if params["show_moblie"]
subject.find(params[:id]).update_attributes(:show_moblie => params[:show_moblie])
return
end
sub_discipline_ids = params[:sub_disciplines] || [] sub_discipline_ids = params[:sub_disciplines] || []
sub_ids = sub_discipline_ids.reject(&:blank?).map(&:to_i) sub_ids = sub_discipline_ids.reject(&:blank?).map(&:to_i)
old_sub_ids = current_subject.sub_discipline_containers.pluck(:sub_discipline_id) old_sub_ids = current_subject.sub_discipline_containers.pluck(:sub_discipline_id)

@ -0,0 +1,7 @@
class SyncSubjectdsMobile < ActiveRecord::Migration[5.2]
def change
SubDisciplineContainer.find_each do |sc|
subject.find(sc.container_id).update_column(:show_mobile => true)
end
end
end
Loading…
Cancel
Save