如何在 rails 管理员中将我的模型分解为两个列表?

How can I break up my model in to two lists in rails admin?

我完成了带有布尔字段的模型任务。在 rails 管理中,它显示在 table 字段中。我怎样才能把这个 table 分成两个列表。在第一个列表中将只有 done=true 的任务。第二个是 done=false。有什么想法吗?

您可以将这些范围添加到任务模型:

scope :done, -> { where done: true }
scope :todo, -> { where done: false }

然后你可以相应地调用作用域: Task.done 或 Task.todo

并显示列表中的任务。

除非您正在寻找 HTML/CSS 解决方案以及如何显示您的列表。

您可以在任务模型中执行这些操作

scope :completed_task, -> { where(done: true) }
scope :incomplete_task, -> { where(done: false) }