Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Default assets registered twice by ActiveAdmin.setup #1845

Closed
ejholmes opened this Issue Jan 7, 2013 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

ejholmes commented Jan 7, 2013

Whenever ActiveAdmin.setup is called, it calls register_default_assets, which means the same assets (active_admin.js, active_admin.css, etc) get added multiple times.

This is somewhat of an issue for engines that need to include additional assets (see active_admin_editor). It can be navigated around by explicitly calling ActiveAdmin.application.register_(javascript|stylesheet), but I think it makes more sense to call ActiveAdmin.setup.

Owner

seanlinsley commented Jan 10, 2013

For lib/active_admin/asset_registration.rb

@@ -4,7 +4,8 @@ module ActiveAdmin
     # Stylesheets

     def register_stylesheet(*args)
-      stylesheets << ActiveAdmin::Stylesheet.new(*args)
+      tmp = ActiveAdmin::Stylesheet.new(*args)
+      stylesheets << tmp unless stylesheets.include? tmp
     end

     def stylesheets
@@ -19,7 +20,7 @@ module ActiveAdmin
     # Javascripts

     def register_javascript(name)
-      javascripts << name
+      javascripts << name unless javascripts.include? name
     end

     def javascripts
Owner

seanlinsley commented Apr 25, 2013

This will be resolved when #2139 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment