Users of some admin need to have two table views of, say, a model Bar: default one they already have and an additional new one with different set of columns.
The setting is such:
ActiveAdmin.register Bar do
# …
index do
column :name
column :phone
column :address
end
# …
It's expected to be as easy as adding another index block as in:
ActiveAdmin.register Bar do
# …
index do
column :name
column :price
column :bartender
end
index name: 'location' do
column :name
column :phone
column :city
column :country
end
and then just get the additional tab somewhere.
As you may guess it is not that simple. ActiveAdmin nows nothing about the imaginary index name: attribute and just selects the first index block silently ignoring the second index block.
ActiveAdmin documentation shows a way to add second/third/etc index page with ease but of a different kind:
index as: :grid do |bar|
link_to(image_tag(bar.photo_path), admin_bar_path(bar))
end
Nice, but how to add a duplicate of the index table view with different columns?