-
Create folder
app/assets/javascripts
-
Create file
app/assets/javascripts/application.js
-
Add some JS inside. You can use directives; e.g.:
//= require_tree . console.log('howdy');
-
In
app/assets/config/manifest.js
, add://= link application.js
-
In
app/views/layouts/application.html.erb
, add:<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
That's it. If you used the example JS above, you should see "howdy" in the JS console when you visit a page.