I am working on a project that uses ActiveAdmin for its administration.
I have two models, a book model in which there are products. When I try to access the product index view in ActiveAdmin, it seems that it is trying to load the entire table of books into memory (there are about 1.5 million books in my database). CPU usage reaches 100%, and memory usage up to gigabytes.
Enabling mysql logging confirms that this happens when this view is called:
17 Query SELECT `books`.* FROM `books`
As far as I can tell this, this happens before any attempt to download products.
To understand this problem, I stripped the models to their bare bones:
class Product < ActiveRecord::Base belongs_to :book end class Book < ActiveRecord::Base has_many :products end
I also reduced the definition of AA to its basic form:
ActiveAdmin.register Product do end
Is this normal for ActiveAdmin? This does not seem to be the desired behavior.
source share