I'm trying to load some JavaScript in my rails application like so:
Application.html.erb (in the head)
<%= javascript_include_tag 'application' %>
Application.html.erb (before end of HTML)
<script>
$(document).ready(function() {
notie.alert(1, "It Works", 2);
});
</script>
Application.js
//= require rails-ujs
//= require turbolinks
//= require theme/jquery
//= require theme/bootstrap
//= require theme/select2
//= require theme/notie
//= require theme/plugins
//= require theme/app
//= require_tree .
With this set up, I'm getting the following errors:
TypeError: document.body is null
TypeError: notie is undefined
It seems to me that the error may be because of turbolinks and how the JS is loaded with the asset pipeline but for the life of me I can't figure out where it's going wrong. Any help is appreciated.