I’ve noticed that ActiveAdmin gets initialized and loaded even when I start up a rake task. Is there any way to specify that all files that ActiveAdmin creates under app/admin be loaded only when rails server gets booted?
The reason this is so problematic is because when you do something like the following:
ActiveAdmin.register Tip do
filter :score_type, :as => :select, :collection => Tip.all
end
And you try to do a rake db:create, followed by a rake db:migrate, this file loads but Tip doesn’t exist yet!
This answers your question, but I believe will not solve your true problem.
In Ruby, to tell if a constant is defined:
So, you could wrap your ActiveAdmin definitions like so: