In my rails app, in a javascript file in assets/javascripts, the first line is
console.log("This javascript file is included"). In My application.html, I include this right after the head:
<script type = "text/javascript">
console.log("Logging from the application.html")
</script>
I don’t explicitly include the javascript file in any of my views, yet the console prints:
This javascript file is included.
Logging from the application.html
You’re application.js probably looks something like:
//= require_tree .
“The require_tree directive tells Sprockets to recursively include all JavaScript files in the specified directory into the output. These paths must be specified relative to the manifest file. You can also use the require_directory directive which includes all JavaScript files only in the directory specified, without recursion.”
http://guides.rubyonrails.org/asset_pipeline.html