Active Admin: Including Javascript

Mexxer picture Mexxer · Jun 6, 2012 · Viewed 12.3k times · Source

I want to add Gon ( https://github.com/gazay/gon ) to my activeadmin

but I need to add the line

<%= include_gon %>

to the head section in the layout

but I can't figure out how?

Answer

leonel picture leonel · Jul 2, 2012

To add to Mexxer's comment. Go to `config/initializers/active_admin.rb

At the bottom of the page, you'll find the following:

# == Register Stylesheets & Javascripts
#
# We recommend using the built in Active Admin layout and loading
# up your own stylesheets / javascripts to customize the look
# and feel.
#
# To load a stylesheet:
#   config.register_stylesheet 'my_stylesheet.css'
#
# To load a javascript file:
#   config.register_javascript 'my_javascript.js'

Uncomment the last line and replace my_javascript.js with your file, like this...

# To load a javascript file:
config.register_javascript 'invoices.js'

That file can be located at app/assets/javascripts/invoices.js