We try to describe less obvious tips and techniques for Rails apps in our blog, so this time we are presenting you ActiveAdmin performance optimization for Rails apps.
ActiveAdmin gem is a popular tool for building admin interfaces in Ruby on Rails apps.
Here come the tips:
Add query persistence to filters. One issue with default implementation is that the search query is not persistent. Every time you click away to a different page, you need to do a new search from scratch.
Normalize blank attributes. ActiveAdmin uses Formtastic under the hood. There is a known issue with blank values populating your models after submitting a form with empty fields.
Watch out for slow filters. The problem is that ActiveAdmin creates a select filter for all the
has_manyrelation on a model. So if a user
/admin/usersview will display select box, rendering data of ALL the posts present in the database.
Use custom form views. You need to start by declaring a batch action that renders a view and another one that receives params submitted from the form.
Interested? Find more tips here.
P.S. While using Rails app, remember what can cause Rails apps outages.
And find more Rails tips in our video screencasts!