Reputation: 668
I am using heroku for my main app, but now i have separated it to main_app and admin_app (memory issues).
So i have 2 apps running on the same git repo with no problems.
main_app uses subdomain admin. to resolve admin_app
now i want to save some memory without loading active admin.
i use a group in gemfile
group :admin_app do
gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin'
end
and in application.rb when admin_app loaded
Bundler.require(*Rails.groups,:admin_app)
Now, i have the admin folder which is located on app/admin gets auto loaded so i have to ignore it or else i get an exception (no active_admin gem on main_app)
i solved it by a simple if statement
if Rails.application.secrets.admin_app
ActiveAdmin.register ForumTopic ....
end
i am looking for a better fix for this problem .
i tried moving admin folder to lib or outside the app folder and then add it to
config.autoload_paths << Rails.root.join('admin')
but i just don't see it get loaded when using
ActiveSupport::Dependencies.autoload_paths
i whould like to hear your ideas, thank's
Upvotes: 1
Views: 201
Reputation: 668
I couldn't find the reason autoload_paths didn't include my files.
I add active_admin files to 'lib' folder and then conditionally required them when
drawing the active_admin routes.
Upvotes: 3