Follow Along as I Stumble on the Path to Learning RoR

Improving ActiveAdmin Performance

ActiveAdmin is my favorite gem for creating admin features in Rails.  It makes it so easy to create views to monitor and manage apps.  Much of the heavy lifting is done for you by them gem.

I found that I need to do some tuning on my ActiveAdmin views to get the functionality I wanted without placing too heavy a burden on my server.

I mainly did this by doing two simple things:

(1) Specify Filters – if you don’t specify your filters, you may get far too many (and consuming too many resources when you don’t need to).  Specifying filters are easy, just go into you admin files for the resource (i.e. app > admin > article.rb), then add a line for each filter you want

filter :title
filter :created_at

(2)  Specify Index (and other) Columns – similar to above, if you don’t specify values, you may be receiving too much data.  Be more efficient by only showing what you need to see in a view.

You can do this in your admin file for a resource, simply by adding this:

index do
column :title
column :description
column :created_at
column :updated_at
end

 

 

Advertisements

Comments are closed.