activeadmin - column sum on index page active_admin rails -
update...
i have method gives me sum of column. how phone call method , show in div above table on index page?
activeadmin.register business relationship actions :all, :except => [:new] index 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 def total_followers account.sum(:followers_count) end end end
the way have it, total_followers
local variable set @ load time of class , never updated, you've experienced. way prepare create total_followers
method, such as:
activeadmin.register business relationship def total_followers account.sum(:&followers_count) end # ... end
then accounts addition evaluated each time method called.
ruby-on-rails activeadmin
No comments:
Post a Comment