我想做这样的事情:
ActiveAdmin.register Split do
index do
panel "Cute" do
if cute?
column :blah
default_actions
end
end
panel "Not so cute" do
if not cute?
column :toot
default_actions
end
end
end
end
其中有一个Cute
表,其中列出了所有cute?
为真的对象,然后是Not so cute
表,其中cute?
为假。
问题是我不知道如何将其拆分为两个不同的表/面板。 我收到以下错误:
undefined method `column' for <div class="index_as_table"></div>
:ActiveAdmin::Views::IndexAsTable
这让我相信我不应该使用上面的panel
column
。 我搜索了 ActiveAdmin 文档,找不到有关将索引表视图拆分为两个表的任何内容
我所知道的最接近的解决方案是使用两个不同的选项卡(每个面板一个),这是在 activeadmin 中设置范围时自动完成的。
# app/admin/splits.rb
scope :cute, :default => true
scope :not_cute
# app/models/splits.rb
scope :cute, where(:cute=> true)
scope :not_cute, where(:cute => false)