Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Default assets registered twice by ActiveAdmin.setup #1845

Closed
ejholmes opened this Issue · 2 comments

2 participants

@ejholmes

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.

@seanlinsley
Owner

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
@seanlinsley
Owner

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
Something went wrong with that request. Please try again.