隐藏的实训除超级管理员外,其他人无法查看

dev_trainings
daiao 6 years ago
parent 928a392347
commit a0ea38196b

@ -119,6 +119,9 @@ class ShixunsService
@children_list = []
# 目前只取十个不多N+1问题不大
# 需要彻底解决则需要改数据路结构比如Nested算法可以解决
unless current_user.admin?
discusses = discusses.where(:hidden => false)
end
if discusses.present?
discusses.each do |d|
# 总点赞数

@ -0,0 +1,8 @@
class ModifyHiddenDefualtForDiscusses < ActiveRecord::Migration
def up
change_column :discusses, :hidden, :boolean, :default => true
end
def down
end
end
Loading…
Cancel
Save