I want to add JS from the Google Analytics Deployment API to my rails application and only for Rails Admin (not required anywhere).
We have rewritten the Rails Admin control panel, and now we are struggling with custom JS.
I found here: https://groups.google.com/forum/#!topic/rails_admin/KgUl3gF5kTg that it needs to be placed in app/assets/javascripts/rails_admin/custom/ui.js
So, I put all .js files and .js.map files in a directory:
. └── custom ├── active-users.js ├── chart.js ├── datepicker.js ├── moment.js ├── platform.js ├── platform.js.map ├── polymer.js ├── polymer.js.map ├── promise.js ├── ui.js └── viewpicker.js
And I added //= require_tree . to the ui.js file, but in rails_admin I still get:
Uncaught ReferenceError: Polymer is not defined
This means that the .JS file is not loaded.
Thanks to this link to find the link above: Rails Admin: add javascript library to custom action
Edit 1: Using Rails Admin in Rails 3 env.
Edit 2:
So, for testing reasons, I deleted all custom JS / HTML, etc.
I installed this in the ui.js file:
I installed this in leecher.js file:
$(document).ready(function() { document.MY_SIMPLE_VARIABLE = 2; } );
When I restart the server, I go to the rails administrator, log out, restart the server again, and log in. Enter the console in chrome and enter:
document.MY_SIMPLE_VARIABLE
And I get the following: 
For testing reasons, I added:
alert("hello world");
But still no trigger.
Location of ui.js and leecher.js:
app / assets / javascripts / rails_admin / custom /
And this is my current Gemfile:
http://pastie.org/private/zrrzjpbx5jq7enpeknsa
Edit 3: If I put the JS code in ui.js, it will display a warning! So these are problems with include (// = require tree.)
Edit 4: All JS files I use: https://gist.github.com/YOUConsulting/243397c31ea28d217367
Simple example: does not work : https://gist.github.com/YOUConsulting/571e785d6b6c1ed06d6b
Simple example: works : https://gist.github.com/YOUConsulting/52de78aa043239aae707