I'd like to have use the data I manage to get inside an array of array to put them inside a table(table_for) on one of my Dashboards on Active Admin
My app is a Daily Deal app built to learn more Ruby on Rails.
Thanks to help on SO, I now manage to get all the data i need inside an Array: Count occurrence of values in a serialized attribute(array) in Active Admin dashboard (Rails, Active admin 1.0, Postgresql database, postgres_ext gem)
The array's data I want to use looks like (it's actually an array of array)

But what i'd like is something looking like the image below, so i want to use Active Admin's table_for (to have all the export features later on):

My current code on my Dashboard page is
columns do
column do
data = Deal.connection.select_rows(
%q{ with expanded_deals(id, goal) as (
select id, unnest(deal_main_goal)
from deals)
select goal, count(*) n
from expanded_deals
group by goal
order by goal; }).each do |row|
goal = row.first
n = row.last.to_i
#....
end
panel "Top Goals" do
table_for data do
#code
end
end
end
end
Even without putting any code inside table_for data, I already get the error:
undefined method `to_key' for ["Acquisition (website or newsletter opt-ins)", "3"]:Array
How can I use the array's data to put them inside a standard table_for with my basic columns "goal"/"number of deals"?
I might have stumbled upon a ticket on AA that says it might not be possible: https://github.com/gregbell/active_admin/issues/1713
Would anybody know how to do that?