I installed the active_admin gem in a working rails application. After doing this, the app noticeably slowed down. It takes around 4-5 seconds to get a new page. Some functionality is broken.
Is this possibly due to active admin relying on devise and conflicts arising because I have my own authentication? I already had a User model with methods like ‘current_user’ and sign in features.
In other words, are you not supposed to use active admin unless using devise for authentication? I don’t see anything about this in the documentation.
I’m on Rails 3.1, Postgresql database, if that matters.
The slow down in Rails 3.1 is a known issue that is mostly due to the the way Active Admin interacts with the new Asset Pipeline. The issue is – as far as I’m aware – only present when running in development mode (so when you deploy to production it should go away).
There is also a memory leak issue in development that might have a performance impact. But my personal experience is that this isn’t the main performance killer.
To overcome the slow environment issue in development, one quick fix is to install the rails-dev-tweaks gem. This will prevent Rails from regenerating assets when the incoming request is an asset request (images, css, js etc.).
As to your second question: Active Admin only works with devise. But it is entirely possible to use a different authentication mechanism in your frontend and only rely on Devise in Active Admin. You should of cause ensure that Devise and your own authentication does not conflict. You can change devise and Active Admin to use a different method for retrieving the current user. By default Active Admin uses
current_admin_user– notcurrent_user. You can change the authentication settings for Active Admin inconfig/initializers/active_admin.rb. For more info, read the authentication documentation.