1
更新...索引頁上的列總數active_admin rails
我有一個方法,給我一個列的總和。我如何調用這個方法並將它顯示在索引頁上的表格上方的div中?
ActiveAdmin.register Account do
actions :all, :except => [:new]
index do
selectable_column
column :id
column :uid
column :nickname
column :name
column :description
column :listed_count
column :friends_count
column :followers_count
column :created_at
column :updated_at
column :active
actions
end
controller do
def total_followers
Account.sum(:followers_count)
end
end
end
關於此功能的討論https://github.com/activeadmin/activeadmin/issues/3797 – Fivell
http://stackoverflow.com/questions/24314665/column-sum-on-index-page-active-admin -rails – Fivell